Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] continent changes
Home

[Freeciv-Dev] continent changes

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] continent changes
From: Per Inge Mathisen <per@xxxxxxxxxxx>
Date: Sat, 5 Mar 2005 13:35:43 +0000 (GMT)

I am looking at the ai_data_get() function, and the way the aidata code
handles continent changes, and get a really bad feeling about how all this
is handled.

The problem is that right now the number of continents can change at any
time. The AI has to recheck every time we grab an aidata pointer that its
contents (some of which are arrays the size of all continents) is still
valid. However, we grab an aidata pointer sometimes very deep in the code,
and if the number of continents does change, ai_data_init() it rerun,
which is rather high-level. I can see a lot of rare and hard to find bugs
coming from here. But I do not see many other good solutions to this mess.

One idea is to restrict all continent removal and adding to the very end
of the turn. On the beginning of the next turn we will recalculate
everything anyway. This will work for engineer terrain transformations,
but not for antimatter bombs or dynamic map editing, should we desire
either of these things.

Another idea is to explicitly ask the AI to recalculate its aidata
whenever we transform terrain so that the continent number might have
changed.

  - Per




[Prev in Thread] Current Thread [Next in Thread]