[Freeciv-Dev] Re: (PR#9193) Save worklists and city production by name
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9193 >
Mateusz Stefek wrote:
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=9193 >
>
>>With attached patch worklists and city productions are no more
>>dependent on the order in which improvements or units are read from
>>ruleset.
I'd still like for someone to verify that the arrays in savegame.c
correspond to the current (or 1.14.1) improvement values.
> How should I implement it?
> Each city has its improvements list which is currently saved as
> bitvector ("00101001..")
> My idea is to save it as text which is divided with some special
> character.
> For example: "Temple|Granary|Harbour".
Here it becomes ugly. Writing out "temple" for every city that has a
temple seems way too inefficient.
Maybe it would be better to store the order separately and use that to
recover the values from the array.
all_improvements = "Temple", "Granary", "Harbour", ...
bitvector = 101...
Or maybe the registry code can do this automatically if you lookup
city%d.has_%s (where %d = city ID and %s = improvement name). Probably
this is the way to go.
jason
|
|