Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2006:
[Freeciv-Dev] (PR#20386) [PATCH] Let the AI decide the next impr. to bui
Home

[Freeciv-Dev] (PR#20386) [PATCH] Let the AI decide the next impr. to bui

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#20386) [PATCH] Let the AI decide the next impr. to build in player's city
From: "Petr Baudis" <pasky@xxxxxx>
Date: Sun, 3 Sep 2006 06:42:15 -0700
Reply-to: bugs@xxxxxxxxxxx

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

  Hi,

  currently, the AI does not get a say in what improvement to build next
in the player's city, which means that when your worklist runs out, all
those size two/three cities will start building aquaducts and then go on
in the alphabet order. It appears to be a mere oversight, not an
intention (I hope). The AI is far from smart (wants to build city walls
in all cities when there's a hot border on the opposite side of your
huge continent, then builds colosseums in all those cities with no
unhappy citizens at all while I'd prefer it to build
libraries/marketplaces), but still better than just going in the
alphabetic order. :-)

Index: ai/aicity.c
===================================================================
--- ai/aicity.c (revision 12298)
+++ ai/aicity.c (working copy)
@@ -1097,21 +1098,23 @@
                    || is_building_replaced(pcity, id)) {
           /* Don't consider impossible or redundant buildings */
           pcity->ai.building_want[id] = 0;
-        } else if (pplayer->ai.control
-                   && pcity->ai.next_recalc <= game.info.turn) {
+        } else {
           /* Building wants vary relatively slowly, so not worthwhile
            * recalculating them every turn.
            * We DO want to calculate (tech) wants because of buildings
            * we already have. */
           const bool already = city_got_building(pcity, id);
 
-          adjust_improvement_wants_by_effects(pplayer, pcity, 
-                                              pimpr, already);
-
-          assert(!(already && 0 < pcity->ai.building_want[id]));
-        } else if (city_got_building(pcity, id)) {
-          /* Never want to build something we already have. */
-          pcity->ai.building_want[id] = 0;
+         if ((!pplayer->ai.control || pcity->ai.next_recalc > game.info.turn)
+             && already) {
+            /* Never want to build something we already have. */
+           pcity->ai.building_want[id] = 0;
+         } else if (!pplayer->ai.control
+                    || pcity->ai.next_recalc <= game.info.turn) {
+            adjust_improvement_wants_by_effects(pplayer, pcity, 
+                                                pimpr, already);
+           assert(!(already && 0 < pcity->ai.building_want[id]));
+         }
         }
         /* else wait until a later turn */
       } city_list_iterate_end;

-- 
                                Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
Snow falling on Perl. White noise covering line noise.
Hides all the bugs too. -- J. Putnam





[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#20386) [PATCH] Let the AI decide the next impr. to build in player's city, Petr Baudis <=