Skip to content

Commit

Permalink
Fix save game system not saving arrays of EHANDLEs if the first half …
Browse files Browse the repository at this point in the history
…of the array contains null handles

Resolves #224
  • Loading branch information
SamVanheer committed Oct 4, 2023
1 parent 04f3d11 commit d5d96d3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dlls/util.cpp
Expand Up @@ -1666,7 +1666,7 @@ static int gSizes[FIELD_TYPECOUNT] =
sizeof(int), // FIELD_STRING
sizeof(int), // FIELD_ENTITY
sizeof(int), // FIELD_CLASSPTR
sizeof(int), // FIELD_EHANDLE
sizeof(EHANDLE), // FIELD_EHANDLE
sizeof(int), // FIELD_entvars_t
sizeof(int), // FIELD_EDICT
sizeof(float) * 3, // FIELD_VECTOR
Expand Down Expand Up @@ -2327,7 +2327,7 @@ int CRestore::ReadField(void* pBaseData, TYPEDESCRIPTION* pFields, int fieldCoun
break;
case FIELD_EHANDLE:
// Input and Output sizes are different!
pOutputData = (char*)pOutputData + j * (sizeof(EHANDLE) - gSizes[pTest->fieldType]);
pInputData = (char*)pData + j * sizeof(int);
entityIndex = *(int*)pInputData;
pent = EntityFromIndex(entityIndex);
if (pent)
Expand Down

0 comments on commit d5d96d3

Please sign in to comment.