Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] Re: (PR#12498) bug in saved games in latest cvs version (M
Home

[Freeciv-Dev] Re: (PR#12498) bug in saved games in latest cvs version (M

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: xbertje@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#12498) bug in saved games in latest cvs version (March 12, 2005)
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 14 Mar 2005 10:21:26 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12498 >

Benoit Hudson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=12498 >
> 
> On Mon, Mar 14, 2005 at 08:57:53AM -0800, Jason Short wrote:
> 
>>However this makes loading a saved game impossible.  We can't call gcr 
>>with the value FALSE because we need a full city refresh.  But if we 
>>call it with TRUE then we get recursion which doesn't do a full city 
>>refresh.
> 
> 
> Shouldn't it work to call gcr with FALSE when loading, then when done
> loading just loop over all cities calling gcr with TRUE?

No, because then the cached values (pcity->bonus, pcity->tile_output) 
won't be initialized.

> Your patch may be correct anyway; I just don't understand how it fixes
> the bug you've diagnosed since as I understand it, we can't call gcr
> with TRUE until we're done loading.

The gcr calls aren't done until all cities are loaded at the very end of 
the load-game process.

> Possibly the correct answer is to have traderoutes only be added after
> all cities have been created.  So the savegame format would be:
>         city0, ...
>         city1, ...
>         ...
>         traderoute0 city1 city3
> 
> Then we wouldn't have cross-city dependencies until all cities exist.

It's not really a matter of cross-city dependencies, just a problem in 
gcr that prevents first-time initialization of the city.  FWIW, the 
other solution I can see is to add another parameter to gcr so that 
separate boolean values control whether a full refresh is done (updating 
the cached values) and whether recursive updating is done (for trade 
routes).  The loading code could then use TRUE for the first and FALSE 
for the second.

-jason





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