Complete.Org: Mailing Lists: Archives: freeciv-dev: August 2000:
[Freeciv-Dev] Re: indefinite improvements
Home

[Freeciv-Dev] Re: indefinite improvements

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: indefinite improvements
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Mon, 21 Aug 2000 23:07:47 +1000 (EST)

Jeff Mallatt <jjm@xxxxxxxxxxxx> wrote:
> At 2000/08/20 01:22 , David Pfitzner wrote:
> >
> >One likely problem I noticed is in common/worklist.h:
> >
> >#define WORKLIST_END (U_LAST+B_LAST+MAX_NUM_WORKLISTS)
> >
> >This value is used in protocol and in savegames as a marker
> >past last used entry in worklist.

> >Suggested fixes:  Use (-1), or 0xFFFF for WORKLIST_END

> Thanks!
> 
> I changed WORKLIST_END to 0xFFFF, and simply changed the save-file loader
> to translate 284 to (the new) WORKLIST_END when loading old save-files
> (discriminated by a new SAVEFILE_OPTION, "new_worklist_end").  The rest of
> the code shouldn't have to change.

Hmm, shouldn't we also translate to/from 284 in the packet code, 
for client/server combinations which disagree about the value 
of WORKLIST_END?

(When we eventually do allow a different value for num_impr_types
in the server, I guess we will need a mandatory capability?
Thats what was done for units and techs.)

Also, I would prefer encoding WORKLIST_END as "-1" in the savefile
(ie, use 0xFF elsewhere, but convert to/from -1 in the save/load 
functions).  That would be shorter (pre-compression) and more 
pleasant for humans inspecting the savefile, since tend to get 
rows like:

284,284,284,284,284,284,284,284,284,284,284,284,284,284,284,284

compare:

65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535,65535

vs 

-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1

(Hmm, or (val+1)&WORKLIST_END: 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 :-)

-- David



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