At the moment the AI code is touched again. As I also started to look into
this code, I do have some notes/thoughts. I post this here for discussion:
* Marko Lindqvist is doing at the moment a separation of the advisor code from
the AI code. At the end, the AI should be a separate library which is only
accessed via function pointers. This requires that no header file from ./ai/
is included by the server but the definition of the AI(s) (at the moment only
defaultai.h) (patch #1709).
* Some ai data is saved for players, (units) and cities. This code should only
be handled by the AI. Thus, the AI needs to read/write the corresponding
parts of the savefile (patch #1784 and patch #1786). If a player is
controlled by a human, this data should not be used? (= NULL?).
* Perhaps, this will result in some data, which is only needed by the
advisor(s). I think, that these data blocks should be saved in
player->advisor, unit->advisor or city->advisor.
* Can the static definition of the citymap in citymap.c be removed? At the
moment it is reused for each player. This means that only one player/AI can
use it at one time. Create and store it in player->advisor->citymap and
destroy it if it is not needed anymore?
It could also be moved into player->server->citymap or even
player->ai_data->citymap as only the autosettler code and the AI uses it.
(Note: the include of citymap.h in srv_main.c is not needed.)
* aisettler.c uses a cachemap. Perhaps this can be replaced by the tile_cache
defined in city.c?
* Merge all AI functions which analyze the ruleset (data_analyze_rulesets(),
update_simple_ai_types()). Call them once per AI (or, if needed, per AI and
Open for discussion ;-)
Matthias Pfafferodt - http://www.mapfa.de
Matthias.Pfafferodt <at> mapfa.de
Freeciv-dev mailing list