Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2000:
[Freeciv-Dev] Re: jjm: Changed old savefile default for diplomatic sta.
Home

[Freeciv-Dev] Re: jjm: Changed old savefile default for diplomatic sta.

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: jjm: Changed old savefile default for diplomatic sta...
From: Jeff Mallatt <jjm@xxxxxxxxxxxx>
Date: Mon, 31 Jul 2000 02:25:33 -0400

At 2000/07/30 23:42 , David Pfitzner wrote:
>> on Sun Jul 30 04:51:26 PDT 2000 = Sun Jul 30 11:51:26 2000 (GMT)
>> by Jeff Mallatt <jjm@xxxxxxxxxxxx>
>> 
>> ---- Files affected:
>> 
>> freeciv/server plrhand.c
>> 
>> ---- Log message:
>> 
>> Changed old savefile default for diplomatic states from DS_NO_CONTACT to
>> DS_NEUTRAL.  Simple fix to keep things rational at game start.
>> Fixes PR#465.
>
>Unfortunately for sufficiently old savegames I now get this:
>
>This is the server for Freeciv version 1.11.5-devel
>You can learn a lot about Freeciv at http://www.freeciv.org/
>1: Loading saved game: t2a.sav
>1: Loading rulesets
>civserver: ../../freeciv-cvs/common/rand.c:57: myrand: Assertion
`rand_state.is_init' failed.
>Aborted (core dumped)
>
>The problem is that myrand() gets called inside 
>handle_player_cancel_pact() via neutralize_ai_player() in 
>game_load(), and rand has not yet been initialized for savegames
>which are old enough to not save rand state. 
>
>One could fix this by calling mysrand() early enough during loading
>such savegames, but I'm concerned about myrand happening at this 
>time -- ie, during game load, and specifically for the following:
>
>    if (has_senate) {
>      if (myrand(GAME_MAX_REPUTATION) > pplayer->reputation) {
>      notify_player(pplayer, _("Game: The senate decides to dissolve "
>                          "rather than support your actions any longer."));
>                          handle_player_revolution(pplayer);
>      }
>    }
>
>That is, shouldn't get a chance of revolution just by loading
>savegame!  (In fact shouldn't call myrand() just from loading.)  
>Its unclear to me whether this may also be a problem (just less 
>obvious) for other (ie recent) savegames, and/or with 
>neutralize_ai_player() in general...

The "warmonger all AIs" loop in game_load() called neutralize_ai_player(),
which calls handle_player_cancel_pact().  This is all, I think, unnecessary
for loaded save-games.  In new save-games, AIs will all be at war with
everyone.  For old save-games, we just want to set them to be at war with
everyone.  The attached patch does just that.

Attachment: warmonger-old-ai-0.diff
Description: Text document

jjm

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