----- Original Message -----
From: "Ari Johnson" <[EMAIL PROTECTED]>
To: "Development list" <warzone-dev@gna.org>
Sent: Wednesday, February 14, 2007 4:37 AM
Subject: Re: [Warzone-dev] Current problems
I didn't make this particular change. I did, however, get savegame
saving and loading to work on the Mac again. I will try the non-Mac
savegame in a bit.
Here is a list of my notes as I went through (line numbers may be a
little off since I have made changes):
evntsave.c:378 Why is numContext signed?
evntsave.c:398 Why is savedNumVars signed?
evntsave.c:361 Why is numVars signed?
evntsave.c:361 Why is numVars double-word while savedNumVars is
single-word?
evntsave.c:417 Why do we use a SDWORD to loop a SWORD?
evntsave.c:455 Should ival be SDWORD or is UDWORD enough?
evntsave.c:497 UDWORD variable stored as UWORD
scriptobj.c:1127 Why do we store a UBYTE as an SDWORD?
No clue.
More importantly, I came across something that would be a showstopper
if it were being saved by the game. In evntsave.c the SCRIPT_VARFUNC
and SCRIPT_FUNC types (indicated by VAL_OBJ_GETSET and
VAL_FUNC_EXTERN) are pointers, and those pointers are being saved
directly into the savegame file on disk. This is very very bad. We
need to come up with a better way to save these.
I'm not sure what to do with SCRIPT_VARFUNC. Maybe we should just hardcode
it in the interpreter, since there's only one SCRIPT_VARFUNC function
anyway, at least I can't think of an elegant solution.
Another odd one is
the way VAL_STRING gets stored. Two conflicting assumptions are at
play. Basically, the string's char* value is set to the position in
the file, as if the string were stored verbatim in the file, but then
the position pointer is updated by sizeof(char*), as if there had been
a char* pointer in the file. I think that an appropriate solution
would involve storing the size of the string as a UWORD or UDWORD and
then the string's characters after that.
Sounds good to me.
There is already a TODO
about strings in eventSaveContext, which I am changing to a more
complete FIXME.
I am committing my changes, with the FIXMEs described above. Please
comment on the list of items I mentioned if you have any thoughts on
them.
Thanks to Troman for helping out with most of the endianization.
_______________________________________________
Warzone-dev mailing list
Warzone-dev@gna.org
https://mail.gna.org/listinfo/warzone-dev