List Info

Thread: (PR#20386) Let the AI decide the next impr. to build in player's city




(PR#20386) Let the AI decide the next impr. to build in player's city
user name
2006-09-03 13:42:15
<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




[1]

about | contact  Other archives ( Real Estate discussion Medical topics )