Complete.Org: Mailing Lists: Archives: freeciv-ai: March 2005:
[freeciv-ai] (PR#12422) stupid AI leaves its city in disorder
Home

[freeciv-ai] (PR#12422) stupid AI leaves its city in disorder

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [freeciv-ai] (PR#12422) stupid AI leaves its city in disorder
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 4 Mar 2005 17:39:35 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [per - Thu Mar 03 23:50:47 2005]:
> 
> On Thu, 3 Mar 2005, Jason Short wrote:
> > Not sure about the bug but your assert is wrong because there is a
> > generic_city_refresh call built in at the start of CM.Here is a more
> > comprehensive and correct assert.
> 
> No, the assert is correct. The generic_city_refresh call calculates the
> city state wrong. The city should be in disorder - it is not.

The assert is surely not correct.  Because the callers pass in cities
that aren't refreshed the refresh _will_ sometimes change this value.  I
also find it unlikely that generic_city_refresh is wrong here - this
function is called so often if it were wrong the whole game would explode.

However there is certainly a bug in ai_manage_taxes.  I think this patch
fixes it (the comment explains the bug).  I think it's in S2_0 as well.

-jason

Index: ai/aihand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aihand.c,v
retrieving revision 1.102
diff -u -r1.102 aihand.c
--- ai/aihand.c 13 Feb 2005 03:01:50 -0000      1.102
+++ ai/aihand.c 5 Mar 2005 01:38:03 -0000
@@ -196,6 +196,11 @@
     } else {
       pplayer->economic.luxury = luxrate;
       pplayer->economic.science = scirate;
+      city_list_iterate(pplayer->cities, pcity) {
+       /* Must refresh to restore the original values (which were clobbered
+        * in cm_query_result, after the tax rates were changed). */
+       generic_city_refresh(pcity, TRUE, NULL);
+      } city_list_iterate_end;
     }
   }
 

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