Make it possible for the ST_GROUP loading code in function scrValDefLoad to accept higher savegame event data versions than 3

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5668 4a71c877-e1ca-e34f-864e-861f7616d084
master
Giel van Schijndel 2008-07-26 00:55:23 +00:00
parent f2bc3c056f
commit 0340c2d9c3
2 changed files with 21 additions and 26 deletions

View File

@ -217,7 +217,7 @@ static BOOL eventSaveContext(char *pBuffer, UDWORD *pSize)
}
// load the context information for the script system
static BOOL eventLoadContext(SDWORD version, char *pBuffer, UDWORD *pSize, BOOL bHashed)
static BOOL eventLoadContext(const SDWORD version, char *pBuffer, UDWORD *pSize, BOOL bHashed)
{
UDWORD size, valSize,stringLen;
SDWORD numVars, i, numContext, context;
@ -506,15 +506,13 @@ static BOOL eventSaveTriggerList(ACTIVE_TRIGGER *psList, char *pBuffer, UDWORD *
// load a list of triggers
static BOOL eventLoadTriggerList(SDWORD version, char *pBuffer, UDWORD *pSize)
static BOOL eventLoadTriggerList(const SDWORD version, char *pBuffer, UDWORD *pSize)
{
UDWORD size, event, offset, time;
char *pPos;
SDWORD numTriggers, context, type, trigger, i;
SCRIPT_CONTEXT *psContext;
version = version;
size = 0;
pPos = pBuffer;

View File

@ -1264,15 +1264,16 @@ BOOL scrValDefLoad(SDWORD version, INTERP_VAL *psVal, char *pBuffer, UDWORD size
pPos = pBuffer;
switch (version)
if (version < 2)
{
case 1:
members = size / sizeof(UDWORD);
break;
case 2:
}
else if (version < 3)
{
members = (size - sizeof(SDWORD)*4) / sizeof(UDWORD);
break;
case 3:
}
else
{
members = (size - sizeof(SDWORD)*6) / sizeof(UDWORD);
// get saved group member count/nullpointer flag
@ -1286,10 +1287,6 @@ BOOL scrValDefLoad(SDWORD version, INTERP_VAL *psVal, char *pBuffer, UDWORD size
ASSERT(savedMembers == members, "scrValDefLoad: calculated and saved group member count did not match." );
}
pPos += sizeof(SDWORD);
break;
default:
members = 0;
debug( LOG_ERROR, "scrValDefLoad: unsupported version %i", version);
}
// make sure group was allocated when it was saved (relevant starting from version 3)