Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2004:
[Freeciv-Dev] (PR#11245) sanity_check_city on an unrefreshed city
Home

[Freeciv-Dev] (PR#11245) sanity_check_city on an unrefreshed city

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#11245) sanity_check_city on an unrefreshed city
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 24 Dec 2004 02:09:07 -0800
Reply-to: bugs@xxxxxxxxxxx

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

Here's a partial patch to make sure the city is refreshed in
sanity_check_city.  However this check fails all over the place because
sanity_check_city is called at the top of aaw when the city is often
unrefreshed.

-jason

Index: server/cityturn.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/cityturn.c,v
retrieving revision 1.290
diff -u -r1.290 cityturn.c
--- server/cityturn.c   21 Dec 2004 22:57:36 -0000      1.290
+++ server/cityturn.c   24 Dec 2004 10:08:08 -0000
@@ -300,9 +300,9 @@
 
   apply_cmresult_to_city(pcity, &cmr);
 
-  sanity_check_city(pcity);
-
   city_refresh(pcity);
+
+  sanity_check_city(pcity);
 }
 
 /**************************************************************************
Index: server/sanitycheck.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/sanitycheck.c,v
retrieving revision 1.57
diff -u -r1.57 sanitycheck.c
--- server/sanitycheck.c        16 Dec 2004 19:45:18 -0000      1.57
+++ server/sanitycheck.c        24 Dec 2004 10:08:09 -0000
@@ -170,6 +170,10 @@
 {
   int workers = 0;
   struct player *pplayer = city_owner(pcity);
+  struct city old_city = *pcity;
+
+  generic_city_refresh(pcity, TRUE, NULL);
+  SANITY_CHECK(memcmp(pcity, &old_city, sizeof(old_city)) == 0);
 
   SANITY_CHECK(pcity->size >= 1);
   SANITY_CHECK(!terrain_has_flag(map_get_terrain(pcity->tile),

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#11245) sanity_check_city on an unrefreshed city, Jason Short <=