mirror of
https://github.com/dhewm/dhewm3-sdk.git
synced 2024-11-21 12:11:07 +00:00
Prevent assert() while saving and restoring events
The argument size of each event is checked in debug builds and this change was missing from the x86_64 commits. Surprisingly this didn't trigger yet with the original game, only with the mod 'Classic Doom 3'.
This commit is contained in:
parent
b8f1a3e38c
commit
0fb3d2d37f
2 changed files with 12 additions and 12 deletions
|
@ -772,17 +772,17 @@ void idEvent::Save( idSaveGame *savefile ) {
|
|||
switch( format[ i ] ) {
|
||||
case D_EVENT_FLOAT :
|
||||
savefile->WriteFloat( *reinterpret_cast<float *>( dataPtr ) );
|
||||
size += sizeof( float );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_INTEGER :
|
||||
case D_EVENT_ENTITY :
|
||||
case D_EVENT_ENTITY_NULL :
|
||||
savefile->WriteInt( *reinterpret_cast<int *>( dataPtr ) );
|
||||
size += sizeof( int );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_VECTOR :
|
||||
savefile->WriteVec3( *reinterpret_cast<idVec3 *>( dataPtr ) );
|
||||
size += sizeof( idVec3 );
|
||||
size += sizeof( E_EVENT_SIZEOF_VEC );
|
||||
break;
|
||||
case D_EVENT_STRING :
|
||||
s.Clear();
|
||||
|
@ -888,17 +888,17 @@ void idEvent::Restore( idRestoreGame *savefile ) {
|
|||
switch( format[ j ] ) {
|
||||
case D_EVENT_FLOAT :
|
||||
savefile->ReadFloat( *reinterpret_cast<float *>( dataPtr ) );
|
||||
size += sizeof( float );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_INTEGER :
|
||||
case D_EVENT_ENTITY :
|
||||
case D_EVENT_ENTITY_NULL :
|
||||
savefile->ReadInt( *reinterpret_cast<int *>( dataPtr ) );
|
||||
size += sizeof( int );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_VECTOR :
|
||||
savefile->ReadVec3( *reinterpret_cast<idVec3 *>( dataPtr ) );
|
||||
size += sizeof( idVec3 );
|
||||
size += sizeof( E_EVENT_SIZEOF_VEC );
|
||||
break;
|
||||
case D_EVENT_STRING :
|
||||
savefile->ReadString(s);
|
||||
|
|
|
@ -638,17 +638,17 @@ void idEvent::Save( idSaveGame *savefile ) {
|
|||
switch( format[ i ] ) {
|
||||
case D_EVENT_FLOAT :
|
||||
savefile->WriteFloat( *reinterpret_cast<float *>( dataPtr ) );
|
||||
size += sizeof( float );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_INTEGER :
|
||||
case D_EVENT_ENTITY :
|
||||
case D_EVENT_ENTITY_NULL :
|
||||
savefile->WriteInt( *reinterpret_cast<int *>( dataPtr ) );
|
||||
size += sizeof( int );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_VECTOR :
|
||||
savefile->WriteVec3( *reinterpret_cast<idVec3 *>( dataPtr ) );
|
||||
size += sizeof( idVec3 );
|
||||
size += sizeof( E_EVENT_SIZEOF_VEC );
|
||||
break;
|
||||
case D_EVENT_STRING :
|
||||
s.Clear();
|
||||
|
@ -737,17 +737,17 @@ void idEvent::Restore( idRestoreGame *savefile ) {
|
|||
switch( format[ j ] ) {
|
||||
case D_EVENT_FLOAT :
|
||||
savefile->ReadFloat( *reinterpret_cast<float *>( dataPtr ) );
|
||||
size += sizeof( float );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_INTEGER :
|
||||
case D_EVENT_ENTITY :
|
||||
case D_EVENT_ENTITY_NULL :
|
||||
savefile->ReadInt( *reinterpret_cast<int *>( dataPtr ) );
|
||||
size += sizeof( int );
|
||||
size += sizeof( intptr_t );
|
||||
break;
|
||||
case D_EVENT_VECTOR :
|
||||
savefile->ReadVec3( *reinterpret_cast<idVec3 *>( dataPtr ) );
|
||||
size += sizeof( idVec3 );
|
||||
size += sizeof( E_EVENT_SIZEOF_VEC );
|
||||
break;
|
||||
case D_EVENT_STRING :
|
||||
savefile->ReadString(s);
|
||||
|
|
Loading…
Reference in a new issue