Author: cazfi
Date: Tue Nov  3 23:54:47 2015
New Revision: 30400

URL: http://svn.gna.org/viewcvs/freeciv?rev=30400&view=rev
Log:
Remove trade routes when cities are removed as part of player removal.

See bug #23970

Modified:
    trunk/server/plrhand.c

Modified: trunk/server/plrhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/plrhand.c?rev=30400&r1=30399&r2=30400&view=diff
==============================================================================
--- trunk/server/plrhand.c      (original)
+++ trunk/server/plrhand.c      Tue Nov  3 23:54:47 2015
@@ -1629,6 +1629,7 @@
     cities_iterate(pcity) {
       if (city_owner(pcity) != pplayer) {
         citizens nationality = citizens_nation_get(pcity, pplayer->slot);
+
         if (nationality != 0) {
           /* Change nationality of the citizens to the nationality of the
            * city owner. */
@@ -1644,6 +1645,14 @@
 
   /* AI type lost control of this player */
   CALL_PLR_AI_FUNC(lost_control, pplayer, pplayer);
+
+  /* Clear all trade routes. This is needed for the other end not
+   * to point to a city removed by player_clear() */
+  city_list_iterate(pplayer->cities, pcity) {
+    trade_routes_iterate_safe(pcity, proute) {
+      remove_trade_route(pcity, proute, TRUE, TRUE);
+    } trade_routes_iterate_safe_end;
+  } city_list_iterate_end;
 
   /* We have to clear all player data before the ai memory is freed because
    * some function may depend on it. */


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to