Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11414) resolve_city_emergency should call is_city_cent
Home

[Freeciv-Dev] (PR#11414) resolve_city_emergency should call is_city_cent

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11414) resolve_city_emergency should call is_city_center
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 14 Dec 2004 23:41:33 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Wed Dec 15 07:13:08 2004]:
> 
> > [jdorje - Wed Dec 08 23:22:51 2004]:
> > 
> > There's this code:
> > 
> >        if (same_pos(acity->tile, ptile)) {
> >          /* can't stop working city center */
> >          continue;
> >        }
> > 
> > which is bad.
> 
> Here's a patch.  I also removed a spurious city_map_to_map call (of
> course another one is added in its place).

Oops.  Obviously that patch had a serious bug.  This one should work.

-jason

Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.183
diff -u -r1.183 aicity.c
--- ai/aicity.c 11 Dec 2004 10:34:45 -0000      1.183
+++ ai/aicity.c 15 Dec 2004 07:40:30 -0000
@@ -1086,14 +1086,14 @@
     bool is_valid;
 
     if (acity && acity != pcity && acity->owner == pcity->owner)  {
-      if (same_pos(acity->tile, ptile)) {
-        /* can't stop working city center */
-        continue;
-      }
       freelog(LOG_DEBUG, "%s taking over %s's square in (%d, %d)",
               pcity->name, acity->name, ptile->x, ptile->y);
       is_valid = map_to_city_map(&city_map_x, &city_map_y, acity, ptile);
       assert(is_valid);
+      if (!is_valid || is_city_center(city_map_x, city_map_y)) {
+        /* can't stop working city center */
+        continue;
+      }
       server_remove_worker_city(acity, city_map_x, city_map_y);
       acity->specialists[DEFAULT_SPECIALIST]++;
       if (!city_list_find_id(&minilist, acity->id)) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11414) resolve_city_emergency should call is_city_center, Jason Short <=