Author: cazfi
Date: Mon Apr 20 23:59:34 2015
New Revision: 28832

URL: http://svn.gna.org/viewcvs/freeciv?rev=28832&view=rev
Log:
Do not try to load route direction for trade routes that do not exist.

See bug #23515

Modified:
    trunk/server/savegame3.c

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=28832&r1=28831&r2=28832&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Mon Apr 20 23:59:34 2015
@@ -4243,12 +4243,15 @@
 
     pcity->trade[i] = secfile_lookup_int_default(loading->file, 0,
                                                  "%s.traderoute%d", citystr, 
i);
-    dir = secfile_lookup_str(loading->file, "%s.route_direction%d", citystr, 
i);
-    sg_warn_ret_val(dir != NULL, FALSE,
-                    "No traderoute direction found for %s", citystr);
-    pcity->trade_direction[i] = route_direction_by_name(dir, fc_strcasecmp);
-    sg_warn_ret_val(route_direction_is_valid(pcity->trade_direction[i]), FALSE,
-                    "Illegal route direction %s", dir);
+
+    if (pcity->trade[i] != 0) {
+      dir = secfile_lookup_str(loading->file, "%s.route_direction%d", citystr, 
i);
+      sg_warn_ret_val(dir != NULL, FALSE,
+                      "No traderoute direction found for %s", citystr);
+      pcity->trade_direction[i] = route_direction_by_name(dir, fc_strcasecmp);
+      sg_warn_ret_val(route_direction_is_valid(pcity->trade_direction[i]), 
FALSE,
+                      "Illegal route direction %s", dir);
+    }
   }
 
   sg_warn_ret_val(secfile_lookup_int(loading->file, &pcity->food_stock,


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

Reply via email to