Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] Re: (PR#18281) assert find_city_from_small_wonder == NULL
Home

[Freeciv-Dev] Re: (PR#18281) assert find_city_from_small_wonder == NULL

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#18281) assert find_city_from_small_wonder == NULL
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Sun, 9 Jul 2006 04:02:42 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Marko Lindqvist wrote:
> 
> My guess 
>   is that initial capital is not properly inserted to small_wonders array.

  Fix.


  - ML

diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c  2006-07-09 04:11:56.156250000 +0300
+++ freeciv/server/citytools.c  2006-07-09 13:49:43.578125000 +0300
@@ -725,6 +725,7 @@
       pnew_city = city_list_get(pplayer->cities, myrand(size));
 
       city_add_improvement(pnew_city, id);
+      pplayer->small_wonders[id] = pnew_city->id;
 
       /*
        * send_player_cities will recalculate all cities and send them to
@@ -961,6 +962,10 @@
        break;
       }
       city_add_improvement(pcity, game.rgame.global_init_buildings[i]);
+      if (is_small_wonder(game.rgame.global_init_buildings[i])) {
+        pplayer->small_wonders[game.rgame.global_init_buildings[i]] = 
pcity->id;
+      }
+      assert(!is_great_wonder(game.rgame.global_init_buildings[i]));
     }
     for (i = 0; i < MAX_NUM_BUILDING_LIST; i++) {
       if (nation->init_buildings[i] == B_LAST) {
diff -Nurd -X.diff_ignore freeciv/server/sanitycheck.c 
freeciv/server/sanitycheck.c
--- freeciv/server/sanitycheck.c        2006-07-09 04:11:56.296875000 +0300
+++ freeciv/server/sanitycheck.c        2006-07-09 04:45:53.484375000 +0300
@@ -229,6 +229,14 @@
     SANITY_CITY(pcity, unit_owner(punit) == pplayer);
   } unit_list_iterate_end;
 
+  built_impr_iterate(pcity, id) {
+    if (is_small_wonder(id)) {
+      SANITY_CITY(pcity, find_city_from_small_wonder(pplayer, id) == pcity);
+    } else if (is_great_wonder(id)) {
+      SANITY_CITY(pcity, find_city_from_great_wonder(id) == pcity);
+    }
+  } built_impr_iterate_end;
+
   /* Note that cities may be found on land or water. */
 
   city_map_iterate(x, y) {

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