Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12548) Save AI unit info
Home

[Freeciv-Dev] (PR#12548) Save AI unit info

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12548) Save AI unit info
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 19 Mar 2005 07:58:14 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12548 >

This patch saves passenger and bodyguard AI info to the savegame. This
should fix a bug that makes AI ferries go pick up new passengers instead
of completing their journeys when loading a game, resulting in the ferries
dumping their current cargo at a pretty random location.

  - Per

Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.226
diff -u -r1.226 savegame.c
--- server/savegame.c   18 Mar 2005 11:26:25 -0000      1.226
+++ server/savegame.c   19 Mar 2005 15:56:46 -0000
@@ -1468,6 +1468,14 @@
       punit->goto_tile = NULL;
     }
 
+    punit->ai.passenger
+      = secfile_lookup_int_default(file, 0, "player%d.u%d.passenger", plrno, 
i);
+    punit->ai.ferryboat
+      = secfile_lookup_int_default(file, 0, "player%d.u%d.ferryboat", plrno, 
i);
+    punit->ai.charge
+      = secfile_lookup_int_default(file, 0, "player%d.u%d.charge", plrno, i);
+    punit->ai.bodyguard
+      = secfile_lookup_int_default(file, 0, "player%d.u%d.bodyguard", plrno, 
i);
     punit->ai.control
       = secfile_lookup_bool(file, "player%d.u%d.ai", plrno, i);
     punit->hp = secfile_lookup_int(file, "player%d.u%d.hp", plrno, i);
@@ -2636,6 +2644,13 @@
     }
 
     secfile_insert_bool(file, punit->ai.control, "player%d.u%d.ai", plrno, i);
+    secfile_insert_int(file, punit->ai.passenger, "player%d.u%d.passenger", 
+                       plrno, i);
+    secfile_insert_int(file, punit->ai.ferryboat, "player%d.u%d.ferryboat", 
+                       plrno, i);
+    secfile_insert_int(file, punit->ai.charge, "player%d.u%d.charge", plrno, 
i);
+    secfile_insert_int(file, punit->ai.bodyguard, "player%d.u%d.bodyguard", 
+                       plrno, i);
     secfile_insert_int(file, punit->ord_map, "player%d.u%d.ord_map", plrno, i);
     secfile_insert_int(file, punit->ord_city, "player%d.u%d.ord_city", plrno, 
i);
     secfile_insert_bool(file, punit->moved, "player%d.u%d.moved", plrno, i);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12548) Save AI unit info, Per I. Mathisen <=