[freeciv-ai] Re: virtual cleanup (PR#4672)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Per I. Mathisen wrote:
> This patch sets some extra variables in the new virtual unit and city
> functions, removes one unused AI variable from pcity, and adds the use of
> the virtual functions to savegame.c.
>
> This should fix ticket "#4672 more uninitialized AI values".
Hmm, I don't know what you mean by "fixes". It avoids the warnings but
not the error itself: instead of using unitialized values, the AI will
now be using values of zero.
At first it seems like create_city_virtual should be used to create
cities in savegame.c. But on further reflection this may just conceal
errors - everything in the savegame should be explicitly initialized.
But we're obviously not going to initialize all the AI data to valid
values at this point, so maybe it would be good. Even so I don't know
if the AI data should be initialized in create_city_virtual...
Also the removal of the workremain field might as well be its own patch.
I do think we need to fix the problem at the source in any case: perhaps
something like this patch?
jason
Index: ai/aidata.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aidata.c,v
retrieving revision 1.20
diff -u -r1.20 aidata.c
--- ai/aidata.c 2003/08/08 22:11:41 1.20
+++ ai/aidata.c 2003/08/11 01:51:56
@@ -353,6 +353,8 @@
ai->diplomacy.player_intel[i].asked_about_ceasefire = 0;
ai->diplomacy.player_intel[i].warned_about_space = 0;
}
+
+ assess_danger_player(pplayer);
}
/**************************************************************************
|
|