Author: sveinung
Date: Wed Sep  2 11:19:13 2015
New Revision: 29756

URL: http://svn.gna.org/viewcvs/freeciv?rev=29756&view=rev
Log:
Revert bug #23772 (join foreign city order)

Without a fix to bug #23772 a hypothetical player with a hypothetical
earlier 3.0 save game from a hypothetical rule set that allows joining
allied cities with a hypothetical unit ordered to go to and join an allied
city will get the order upgraded to a goto and found city. The consequence
is that the unit will go to the allied city and abort its orders since there
already is a city there. The player will then have to give the order to join
the allied city one more time.

Reports from Andreas Røsdal <andreasr> shows that the patch for bug #23772
caused segfaults for real Freeciv-web players trying to load real save games
from a real Freeciv-web ruleset. A segfault for real users is much worse
than a hypothetical user having to give an order again.

I don't have a save game to reproduce the issue.

See bug #23772

Modified:
    trunk/server/savecompat.c
    trunk/server/savegame3.c

Modified: trunk/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savecompat.c?rev=29756&r1=29755&r2=29756&view=diff
==============================================================================
--- trunk/server/savecompat.c   (original)
+++ trunk/server/savecompat.c   Wed Sep  2 11:19:13 2015
@@ -1120,12 +1120,7 @@
   switch (order) {
   case ORDER_OLD_BUILD_CITY:
     if (tile_city(tgt_tile)
-#ifdef FREECIV_DEV_SAVE_COMPAT
-        /* Freeciv 3.0 allows joining foreign cities. */
-        ) {
-#else /* FREECIV_DEV_SAVE_COMPAT */
         && city_owner(tile_city(tgt_tile)) == unit_owner(act_unit)) {
-#endif /* FREECIV_DEV_SAVE_COMPAT */
       /* The player's cities are loaded right before his units. It wasn't
        * possible for rulesets to allow joining foreign cities before 3.0.
        * This means that a converted build city order only can be a Join

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=29756&r1=29755&r2=29756&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Wed Sep  2 11:19:13 2015
@@ -3303,34 +3303,6 @@
     sg_load_player_units_transport(loading, pplayer);
   } players_iterate_end;
 
-#ifdef FREECIV_DEV_SAVE_COMPAT
-  /* Upgrade unit orders */
-  players_iterate(pplayer) {
-    unit_list_iterate(pplayer->units, punit) {
-      int i;
-
-      for (i = 0; i < punit->orders.length; i++) {
-        struct unit_order *order = &punit->orders.list[i];
-
-        if (order->order != ORDER_PERFORM_ACTION
-            && order->action == ACTION_COUNT) {
-          /* This order may have been replaced by the perform action
-           * order */
-
-          /* See if a corresponding action exists. */
-          order->action = sg_order_to_action(order->order, punit,
-                                             punit->goto_tile);
-
-          if (order->action != ACTION_COUNT) {
-            /* The order should be upgraded. */
-            order->order = ORDER_PERFORM_ACTION;
-          }
-        }
-      }
-    } unit_list_iterate_end;
-  } players_iterate_end;
-#endif /* FREECIV_DEV_SAVE_COMPAT */
-
   /* Savegame may contain nation assignments that are incompatible with the
    * current nationset -- for instance, if it predates the introduction of
    * nationsets. Ensure they are compatible, one way or another. */
@@ -5184,6 +5156,23 @@
                          ? ACTION_COUNT
                          : char2num(action_unitstr[j]));
 
+#ifdef FREECIV_DEV_SAVE_COMPAT
+        if (order->order != ORDER_PERFORM_ACTION
+            && order->action == ACTION_COUNT) {
+          /* This order may have been replaced by the perform action
+           * order */
+
+          /* See if a corresponding action exists. */
+          order->action = sg_order_to_action(order->order, punit,
+                                             punit->goto_tile);
+
+          if (order->action != ACTION_COUNT) {
+            /* The order should be upgraded. */
+            order->order = ORDER_PERFORM_ACTION;
+          }
+        }
+#endif /* FREECIV_DEV_SAVE_COMPAT */
+
         if (order->order == ORDER_LAST
             || (order->order == ORDER_MOVE && !direction8_is_valid(order->dir))
             || (order->order == ORDER_PERFORM_ACTION


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

Reply via email to