Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2004:
[Freeciv-Dev] (PR#436) Bug: game state not totally preserved in savegame
Home

[Freeciv-Dev] (PR#436) Bug: game state not totally preserved in savegame

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: caz@xxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#436) Bug: game state not totally preserved in savegames
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 22 Aug 2004 23:43:18 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=436 >

> [marko.lindqvist@xxxxxxxxxxx - Sun Aug 22 18:12:51 2004]:
> 
> M.Lindqvist wrote:
> > [jdorje - Mon Jun 28 17:58:48 2004]:
> >>However the city ID's seem to be reordered when the game is loaded.
>  >
> >  But they are saved!
> 
>   I looked into if their order would remain same in genlists. Cities 
> work perfectly well in this respect too. They are saved player by 
> player, in order they appear in player.cities city_list. Loading is made 
> player by player as well and each loaded city is appended to end of 
> player.cities list.
>   Same goes for unit loading concerning player.units, BUT units appear 
> in several other genlists as well and units are appended to these lists 
> at the same time. So unit order in them is same as in player.units, and 
> further; units of first player are first.
>   1) Cities list supported units (ie units that have this city as their 
> home city).
>   2) Each tile lists units standing on them.
> 
>   I can't point out exact code locations which first one affects, but 
> I'm 98% certain that such things exist in AI code at least.
>   Second affects at least defender selection, from equally good 
> defenders first (or last?) one is selected. This has tiny fairness 
> implication as well. I'm afraid that if equally good defenders from two 
> allied players are in same tile, unit from player with lower player id 
> is always selected to defend after save game is loaded and units have 
> not yet moved around. ... Considering it a bit more, I think that 
> there's more serious problems here how defender selection currently 
> fallbacks to unit_list_iterate order, but that's not related to this
ticket.
> 
> 
>   But what is the best way to fix this?

I'm not sure I understand what the problem is.

I understand the get_defender problem as explained in the other ticket.
 Are you saying that saving+reloading will change the order of defenders
because the unit list order is changed?  In this case simply inserting
the units randomly will not fix this because it will be different after
the reload.  And not only that but all the rand() calls will change the
random state.

jason



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