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-861f7616d084master
parent
f2bc3c056f
commit
0340c2d9c3
|
@ -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;
|
||||
|
||||
|
|
|
@ -1264,32 +1264,29 @@ 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:
|
||||
members = (size - sizeof(SDWORD)*4) / sizeof(UDWORD);
|
||||
break;
|
||||
case 3:
|
||||
members = (size - sizeof(SDWORD)*6) / sizeof(UDWORD);
|
||||
members = size / sizeof(UDWORD);
|
||||
}
|
||||
else if (version < 3)
|
||||
{
|
||||
members = (size - sizeof(SDWORD)*4) / sizeof(UDWORD);
|
||||
}
|
||||
else
|
||||
{
|
||||
members = (size - sizeof(SDWORD)*6) / sizeof(UDWORD);
|
||||
|
||||
// get saved group member count/nullpointer flag
|
||||
endian_sdword((SDWORD*)pPos);
|
||||
bObjectDefined = ( *((SDWORD *)pPos) != UNALLOCATED_OBJECT );
|
||||
// get saved group member count/nullpointer flag
|
||||
endian_sdword((SDWORD*)pPos);
|
||||
bObjectDefined = ( *((SDWORD *)pPos) != UNALLOCATED_OBJECT );
|
||||
|
||||
if(bObjectDefined)
|
||||
{
|
||||
savedMembers = *((SDWORD *)pPos); // get number of saved group members
|
||||
if(bObjectDefined)
|
||||
{
|
||||
savedMembers = *((SDWORD *)pPos); // get number of saved group members
|
||||
|
||||
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);
|
||||
ASSERT(savedMembers == members, "scrValDefLoad: calculated and saved group member count did not match." );
|
||||
}
|
||||
pPos += sizeof(SDWORD);
|
||||
}
|
||||
|
||||
// make sure group was allocated when it was saved (relevant starting from version 3)
|
||||
|
|
Loading…
Reference in New Issue