Skip to content

Commit

Permalink
backport RM #1
Browse files Browse the repository at this point in the history
author @cazfi

""I occasionally get the following error when starting a new game : in package_player_info() [../../../../server/plrhand.c::1159]: assertion 'game.info.turn < 1' failed"

The reason would seem to be that turn number is set to 1 before assigning nations, and not vice versa."
  • Loading branch information
Lexxie9952 committed Feb 10, 2024
1 parent f2c31fa commit dfcbc77
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion freeciv/freeciv/server/plrhand.c
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,7 @@ static void package_player_info(struct player *plr,
packet->color_green = preferred->g;
packet->color_blue = preferred->b;
} else {
fc_assert(game.info.turn < 1);
fc_assert(game.info.turn < 1); /* Game has not yet started */
packet->color_valid = FALSE;
/* Client shouldn't use these dummy values */
packet->color_red = 0;
Expand Down
11 changes: 6 additions & 5 deletions freeciv/freeciv/server/srv_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@ void update_nations_with_startpos(void)
}

/**********************************************************************//**
Handles a pick-nation packet from the client. These packets are
Handles a pick-nation packet from the client. These packets are
handled by connection because ctrl users may edit anyone's nation in
pregame, and editing is possible during a running game.
**************************************************************************/
Expand Down Expand Up @@ -3287,16 +3287,17 @@ static void srv_ready(void)
#endif

if (game.info.is_new_game) {
game.info.turn++; /* pregame T0 -> game T1 */
fc_assert(game.info.turn == 1);
game.info.year = game.server.start_year;
/* Must come before assign_player_colors() */
generate_players();
final_ruleset_adjustments();

game.info.turn++; /* Pregame T0 -> game T1 */
fc_assert(game.info.turn == 1);
game.info.year = game.server.start_year;
}

/* If we have a tile map, and MAPGEN_SCENARIO == map.server.generator,
* call map_fractal_generate anyway to make the specials, huts and
* call map_fractal_generate() anyway to make the specials, huts and
* continent numbers. */
if (map_is_empty()
|| (MAPGEN_SCENARIO == wld.map.server.generator
Expand Down

0 comments on commit dfcbc77

Please sign in to comment.