yairm210 / Unciv

Open-source Android/Desktop remake of Civ V
Mozilla Public License 2.0
8.47k stars 1.57k forks source link

AI builds the same wonder as the player had built previous turn #782

Closed Am-per-Sand closed 5 years ago

Am-per-Sand commented 5 years ago

Americans ignore Japanese wonders!!!

Please check the save, press next turn and check if another Louvre gets finished in Washington

sulai commented 5 years ago

I can reproduce and your case is a very special case because the two wonders are finished just one turn apart. In that case, canceling the other wonders does not work.

sulai commented 5 years ago

I tried to fix it, but I didn't find a proper way to test it. You would need to restart your turn, so the cancel-other-wonders thing will get triggered. Do you happen have a saved game of the turn just before (or maybe some turns before)?

yairm210 commented 5 years ago

Hm One thing we should implement for debugging reasons is saving autosaves a number of turns back

ozyxcv commented 5 years ago

I've had this happen playing multiple civs not just the Americans, but usually it only happens on the same turn i.e. I'll get a "_ has been built in __" but it will also be finished in my own on that same turn

yairm210 commented 5 years ago

I see the problem then... 🙄 What happens is, the production points are added on the END of the turn, and it should be thus - because that's when we have the 'start for that turn' for science and gold reasons But the construction is only built at the BEGINNING of the next turn, so you don't build a unit in a full city -> unit built outside city at end of turn -> unit attacked and killed before you had a chance to move it or anything

This leads to a problem when between the end of your turn and the start of the next, the building is no longer available - but you're already amassed all the construction points you need for it, so it gets built anyway!