Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#12434) Fix two wonder city bugs
Home

[Freeciv-Dev] (PR#12434) Fix two wonder city bugs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12434) Fix two wonder city bugs
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 5 Mar 2005 05:30:35 -0800
Reply-to: bugs@xxxxxxxxxxx

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

The new wonder city code has two bugs that are fixed in the attached
patch:
 - if your wonder city is destroyed, the wonder city pointer is left
dangling
 - if you lose you wonder city to another player, this is not updated
properly

  - Per

Index: server/citytools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/citytools.c,v
retrieving revision 1.305
diff -u -r1.305 citytools.c
--- server/citytools.c  14 Feb 2005 22:52:41 -0000      1.305
+++ server/citytools.c  5 Mar 2005 13:27:52 -0000
@@ -49,6 +49,7 @@
 #include "unittools.h"
 
 #include "aicity.h"
+#include "aidata.h"
 #include "aiunit.h"
 
 #include "citytools.h"
@@ -1025,7 +1026,7 @@
 }
 
 /**************************************************************************
-...
+  Remove a city from the game.
 **************************************************************************/
 void remove_city(struct city *pcity)
 {
@@ -1034,6 +1035,11 @@
   struct tile *ptile = pcity->tile;
   bool had_palace = is_capital(pcity);
   char *city_name = mystrdup(pcity->name);
+  struct ai_data *ai = ai_data_get(pplayer);
+
+  if (ai->wonder_city == pcity) {
+    ai->wonder_city = NULL;
+  }
 
   built_impr_iterate(pcity, i) {
     city_remove_improvement(pcity, i);
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.52
diff -u -r1.52 aidata.c
--- ai/aidata.c 2 Mar 2005 10:43:57 -0000       1.52
+++ ai/aidata.c 5 Mar 2005 13:27:52 -0000
@@ -450,6 +450,10 @@
     ai_data_phase_done(pplayer);
     ai_data_phase_init(pplayer, FALSE);
   }
+  if (ai->wonder_city && ai->wonder_city->owner != pplayer->player_no) {
+    /* We lost our wonder city :( */
+    ai->wonder_city = NULL;
+  }
   return ai;
 }
 

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12434) Fix two wonder city bugs, Per I. Mathisen <=