Author: cazfi Date: Sun Oct 25 10:05:52 2015 New Revision: 30207 URL: http://svn.gna.org/viewcvs/freeciv?rev=30207&view=rev Log: Do not refresh cities during savegame loading when tradepartner has not necessarily beed loaded yet.
See bug #23614 Modified: trunk/common/city.c trunk/server/savegame2.c trunk/server/savegame3.c Modified: trunk/common/city.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/city.c?rev=30207&r1=30206&r2=30207&view=diff ============================================================================== --- trunk/common/city.c (original) +++ trunk/common/city.c Sun Oct 25 10:05:52 2015 @@ -2778,7 +2778,11 @@ /* Add on special extra incomes: trade routes and tithes. */ trade_routes_iterate(pcity, proute) { struct city *tcity = game_city_by_number(proute->partner); - bool can_trade = can_cities_trade(pcity, tcity); + bool can_trade; + + fc_assert(tcity != NULL); + + can_trade = can_cities_trade(pcity, tcity); if (!can_trade) { enum trade_route_type type = cities_trade_route_type(pcity, tcity); Modified: trunk/server/savegame2.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=30207&r1=30206&r2=30207&view=diff ============================================================================== --- trunk/server/savegame2.c (original) +++ trunk/server/savegame2.c Sun Oct 25 10:05:52 2015 @@ -2591,9 +2591,13 @@ /* Update all city information. This must come after all cities are * loaded (in player_load) but before player (dumb) cities are loaded * in player_load_vision(). */ - cities_iterate(pcity) { - city_refresh_from_main_map(pcity, NULL); - } cities_iterate_end; + players_iterate(plr) { + city_list_iterate(plr->cities, pcity) { + city_refresh(pcity); + sanity_check_city(pcity); + CALL_PLR_AI_FUNC(city_got, plr, plr, pcity); + } city_list_iterate_end; + } players_iterate_end; /* Since the cities must be placed on the map to put them on the player map we do this afterwards */ @@ -3115,12 +3119,6 @@ vision_reveal_tiles(pcity->server.vision, game.server.vision_reveal_tiles); city_refresh_vision(pcity); - /* Refresh the city. This also checks the squared city radius. Thus, it - * must be after improvements, as the effect City_Radius_SQ could be - * influenced by improvements; and after the vision is defined, as the - * function calls city_refresh_vision(). */ - city_refresh(pcity); - city_list_append(plr->cities, pcity); } @@ -3169,13 +3167,6 @@ tasks_handled = TRUE; } } - - /* Check the sanity of the cities. */ - city_list_iterate(plr->cities, pcity) { - city_refresh(pcity); - sanity_check_city(pcity); - CALL_PLR_AI_FUNC(city_got, plr, plr, pcity); - } city_list_iterate_end; } /**************************************************************************** Modified: trunk/server/savegame3.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=30207&r1=30206&r2=30207&view=diff ============================================================================== --- trunk/server/savegame3.c (original) +++ trunk/server/savegame3.c Sun Oct 25 10:05:52 2015 @@ -3419,9 +3419,13 @@ /* Update all city information. This must come after all cities are * loaded (in player_load) but before player (dumb) cities are loaded * in player_load_vision(). */ - cities_iterate(pcity) { - city_refresh_from_main_map(pcity, NULL); - } cities_iterate_end; + players_iterate(plr) { + city_list_iterate(plr->cities, pcity) { + city_refresh(pcity); + sanity_check_city(pcity); + CALL_PLR_AI_FUNC(city_got, plr, plr, pcity); + } city_list_iterate_end; + } players_iterate_end; /* Since the cities must be placed on the map to put them on the player map we do this afterwards */ @@ -4277,12 +4281,6 @@ vision_reveal_tiles(pcity->server.vision, game.server.vision_reveal_tiles); city_refresh_vision(pcity); - /* Refresh the city. This also checks the squared city radius. Thus, it - * must be after improvements, as the effect City_Radius_SQ could be - * influenced by improvements; and after the vision is defined, as the - * function calls city_refresh_vision(). */ - city_refresh(pcity); - city_list_append(plr->cities, pcity); } @@ -4331,13 +4329,6 @@ tasks_handled = TRUE; } } - - /* Check the sanity of the cities. */ - city_list_iterate(plr->cities, pcity) { - city_refresh(pcity); - sanity_check_city(pcity); - CALL_PLR_AI_FUNC(city_got, plr, plr, pcity); - } city_list_iterate_end; } /**************************************************************************** _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits