From dfcbc7720afa3963188e5f52f8d200696b99d670 Mon Sep 17 00:00:00 2001 From: Lexxie9952 <32187224+Lexxie9952@users.noreply.github.com> Date: Sat, 10 Feb 2024 06:47:25 -0800 Subject: [PATCH] backport RM #1 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." --- freeciv/freeciv/server/plrhand.c | 2 +- freeciv/freeciv/server/srv_main.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/freeciv/freeciv/server/plrhand.c b/freeciv/freeciv/server/plrhand.c index 40ea27aaf..9f0421926 100644 --- a/freeciv/freeciv/server/plrhand.c +++ b/freeciv/freeciv/server/plrhand.c @@ -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; diff --git a/freeciv/freeciv/server/srv_main.c b/freeciv/freeciv/server/srv_main.c index 2b05bbf8d..49fccedc3 100644 --- a/freeciv/freeciv/server/srv_main.c +++ b/freeciv/freeciv/server/srv_main.c @@ -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. **************************************************************************/ @@ -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