Skip to content

Commit

Permalink
Fixed game rejoin
Browse files Browse the repository at this point in the history
  • Loading branch information
olell committed Sep 24, 2023
1 parent 305fd44 commit 8ad8f95
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/inc/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ bool Player::isInviolable() {
Game::Game() {
// Allocating 33 bytes of memory for gameID strings
gid = (char *)malloc(33 * sizeof(char));
strcpy(gid, "");
team = Team();
player = Player();
startTime = 0;
Expand Down
8 changes: 2 additions & 6 deletions src/inc/ui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,15 @@ void SkirmishUI::update() {
uint32_t currentTS = getCurrentTS();
if (game->gid[0] == 0) { // No game
setScene(SCENE_NO_GAME);

} else if (game->gid[0] != 0 && // joined
game->startTime == 0) { // but not started game
} else if (strcmp(game->gid, "") != 0 && // joined
game->startTime == 0) { // but not started game
setScene(SCENE_JOINED_GAME);

} else if (game->startTime > 0 && // started game
game->startTime >= currentTS) { // but counting down
setScene(SCENE_COUNTDOWN);

} else if (game->startTime > 0 && // started game
game->startTime < currentTS) { // but running
setScene(SCENE_GAME);

} else { /* Should never happen */
setScene(SCENE_NO_SCENE);
}
Expand Down

0 comments on commit 8ad8f95

Please sign in to comment.