Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13540) Fix AI settlers/workers bug
Home

[Freeciv-Dev] (PR#13540) Fix AI settlers/workers bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#13540) Fix AI settlers/workers bug
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 25 Jul 2005 09:26:48 -0700
Reply-to: bugs@xxxxxxxxxxx

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

The most recent index-to-pointer patch introduced two serious bugs in the
AI.

  - Per

Index: ai/advdomestic.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/advdomestic.c,v
retrieving revision 1.135
diff -u -r1.135 advdomestic.c
--- ai/advdomestic.c    22 Jul 2005 16:18:04 -0000      1.135
+++ ai/advdomestic.c    25 Jul 2005 16:21:37 -0000
@@ -148,9 +148,9 @@
   /* Find out desire for settlers (terrain improvers) */
   unit_type = best_role_unit(pcity, F_SETTLERS);
 
-  if (!unit_type
+  if (unit_type
       && (pcity->id != ai->wonder_city || unit_type->pop_cost == 0)
-      && pcity->surplus[O_FOOD] > utype_upkeep_cost(unit_type,
+      && pcity->surplus[O_FOOD] >= utype_upkeep_cost(unit_type,
                                                    pplayer, gov, O_FOOD)) {
     /* The settler want is calculated in settlers.c called from
      * ai_manage_cities.  The expand value is the % that the AI should
@@ -179,7 +178,7 @@
   /* Basically, copied from above and adjusted. -- jjm */
   unit_type = best_role_unit(pcity, F_CITIES);
 
-  if (!unit_type
+  if (unit_type
       && (pcity->id != ai->wonder_city
           || unit_type->pop_cost == 0)
       && pcity->surplus[O_FOOD] >= utype_upkeep_cost(unit_type,

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#13540) Fix AI settlers/workers bug, Per I. Mathisen <=