Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2003:
[Freeciv-Dev] (PR#6243) fix savegames that don't have valid transported_
Home

[Freeciv-Dev] (PR#6243) fix savegames that don't have valid transported_

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6243) fix savegames that don't have valid transported_by
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 22 Sep 2003 07:04:45 -0700
Reply-to: rt@xxxxxxxxxxxxxx

See $subject.

  - Per

Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.136
diff -u -r1.136 savegame.c
--- server/savegame.c   19 Sep 2003 22:27:18 -0000      1.136
+++ server/savegame.c   22 Sep 2003 14:53:53 -0000
@@ -2221,6 +2221,20 @@
   game.player_idx=0;
   game.player_ptr=&game.players[0];  
 
+  /* Fix ferrying sanity */
+  players_iterate(pplayer) {
+    unit_list_iterate(pplayer->units, punit) {
+      struct unit *ferry = find_unit_by_id(punit->transported_by);
+
+      if (is_ocean(map_get_terrain(punit->x, punit->y))
+          && is_ground_unit(punit) && !ferry) {
+        freelog(LOG_ERROR, "Removing %s's unferried %s in ocean at (%d, %d)",
+                pplayer->name, unit_name(punit->type), punit->x, punit->y);
+        bounce_unit(punit, TRUE);
+      }
+    } unit_list_iterate_end;
+  } players_iterate_end;
+
   return;
 }
 

[Prev in Thread] Current Thread [Next in Thread]