Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#9614) initialize city cache after building a city
Home

[Freeciv-Dev] (PR#9614) initialize city cache after building a city

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9614) initialize city cache after building a city
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 5 Aug 2004 13:00:32 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9614 >

When the AI builds a city in the middle of autosettler actions, the 
cache for that city isn't built.  Perhaps in future other cached items 
may need to be rebuilt too.

This is a major bug!  Settlers will be given nearly random orders.

This patch solves it by calling initialize_infrastructure_cache.  Note 
this means re-initializing all caches for the player, which may be slow. 
  On the other hand cities aren't founded all that often.

jason

? vgcore.pid17225
Index: server/settlers.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settlers.c,v
retrieving revision 1.189
diff -u -r1.189 settlers.c
--- server/settlers.c   5 Aug 2004 11:34:18 -0000       1.189
+++ server/settlers.c   5 Aug 2004 19:57:14 -0000
@@ -78,6 +78,11 @@
     return FALSE;
   }
 
+  /* We have to rebuild at least the cache for this city.  This event is
+   * rare enough we might as well build the whole thing.  Who knows what
+   * else might be cached in the future? */
+  initialize_infrastructure_cache(pplayer);
+
   return TRUE;
 }
 

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