Follow-up Comment #5, bug #13557 (project freeciv):

* x-reverse-ineq-turn75.sav.bz2, a game to reproduce this bug
* p22-aiwonder-v1.diff, a failed attempt to fix this bug

Load this game with S2_2, take human player Philippe le Hardi, click 'Turn
Done', then AIs stop building wonders.

Comment #2 showed that 'AI seems to immediately abandon its wonder city' by
choosing 'no city as wonder city'. Comment #3 showed that server/savegame.c
game_load_internal() calls ai/aicity.c ai_manage_buildings() which 'chooses
the wonder city'.

I can now explain _why_ it chooses no city. game_load_internal() calls
player_load_main() which calls ai_data_get() too early, before loading
cities. So ai_data_get() calculates that player has _zero_ cities on each
continent. Later ai_manage_buildings() requires more than _five_ cities on
the continent of the wonder city. It chooses no city because
(ai->stats.cities[place] > 5) is false.

My p22-aiwonder-v1.diff removes the early call to ai_data_get(). Now
ai->stats.cities[place] has correct value and ai_manage_buildings() can
choose a city. This is not a complete fix because there are two more

0 AI can choose a different city. World has changed during those turns after
the AI began to build a wonder, so ai_manage_buildings() can choose a
different city. Then AI abandons wonder at old city and starts wonder at new
0 If AI chooses the same city, then this city changes to building Aqueduct
for one turn, then returns to building wonder.

To reproduce the second problem:

0 Apply p22-aiwonder-v1.diff to S2_2 server.
0 Load x-reverse-ineq-turn75.sav.bz2.
0 Know that AI Tancredo Neves of Brazil chooses Fortaleza as wonder city.
0 Take human player Philippe le Hardi of Burgundy.
0 '/obs Tan' to observe Brazil.
0 See that Fortaleza builds Great Library.
0 '/tak Phi' to play Burgundy.
0 Click 'Turn Done'.
0 Read 'The Brazilians have stopped building The Great Library(W) in
0 '/obs Tan'
0 See that Fortaleza builds Aqueduct.
0 '/tak Phi'
0 Click 'Turn Done'.
0 Read 'The Brazilians have started building The Great Library(W) in
0 '/obs Tan'
0 See that Fortaleza builds Great Library.

I might not find the answer for the Aqueduct problem, nor for the different
city problem.

(file #10658, file #10659)

Additional Item Attachment:

File name: p22-aiwonder-v1.diff           Size:2 KB
File name: x-reverse-ineq-turn75.sav.bz2  Size:28 KB


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to