From 0fb3d2d37f5ddbf99d16454fae8909e4f5555647 Mon Sep 17 00:00:00 2001 From: dhewg Date: Thu, 12 Jan 2012 19:00:51 +0100 Subject: [PATCH] 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'. --- d3xp/gamesys/Event.cpp | 12 ++++++------ game/gamesys/Event.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/d3xp/gamesys/Event.cpp b/d3xp/gamesys/Event.cpp index 8b5c6f5..83c5e6e 100644 --- a/d3xp/gamesys/Event.cpp +++ b/d3xp/gamesys/Event.cpp @@ -772,17 +772,17 @@ void idEvent::Save( idSaveGame *savefile ) { switch( format[ i ] ) { case D_EVENT_FLOAT : savefile->WriteFloat( *reinterpret_cast( 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( dataPtr ) ); - size += sizeof( int ); + size += sizeof( intptr_t ); break; case D_EVENT_VECTOR : savefile->WriteVec3( *reinterpret_cast( 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( 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( dataPtr ) ); - size += sizeof( int ); + size += sizeof( intptr_t ); break; case D_EVENT_VECTOR : savefile->ReadVec3( *reinterpret_cast( dataPtr ) ); - size += sizeof( idVec3 ); + size += sizeof( E_EVENT_SIZEOF_VEC ); break; case D_EVENT_STRING : savefile->ReadString(s); diff --git a/game/gamesys/Event.cpp b/game/gamesys/Event.cpp index 3c44039..3d38978 100644 --- a/game/gamesys/Event.cpp +++ b/game/gamesys/Event.cpp @@ -638,17 +638,17 @@ void idEvent::Save( idSaveGame *savefile ) { switch( format[ i ] ) { case D_EVENT_FLOAT : savefile->WriteFloat( *reinterpret_cast( 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( dataPtr ) ); - size += sizeof( int ); + size += sizeof( intptr_t ); break; case D_EVENT_VECTOR : savefile->WriteVec3( *reinterpret_cast( 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( 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( dataPtr ) ); - size += sizeof( int ); + size += sizeof( intptr_t ); break; case D_EVENT_VECTOR : savefile->ReadVec3( *reinterpret_cast( dataPtr ) ); - size += sizeof( idVec3 ); + size += sizeof( E_EVENT_SIZEOF_VEC ); break; case D_EVENT_STRING : savefile->ReadString(s);