Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SamVanheer committed Aug 5, 2022
2 parents 6546feb + 4f017fc commit c72ea5b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
8 changes: 1 addition & 7 deletions dlls/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@ extern edict_t* EntSelectSpawnPoint(CBaseEntity* pPlayer);
// Global Savedata for player
TYPEDESCRIPTION CBasePlayer::m_playerSaveData[] =
{
DEFINE_FIELD(CBasePlayer, m_MapName, FIELD_STRING),

DEFINE_FIELD(CBasePlayer, m_flFlashLightTime, FIELD_TIME),
DEFINE_FIELD(CBasePlayer, m_iFlashBattery, FIELD_INTEGER),

Expand Down Expand Up @@ -2909,8 +2907,6 @@ bool CBasePlayer::Save(CSave& save)
if (!CBaseMonster::Save(save))
return false;

m_MapName = ALLOC_STRING(STRING(gpGlobals->mapname));

return save.WriteFields("PLAYER", this, m_playerSaveData, ARRAYSIZE(m_playerSaveData));
}

Expand Down Expand Up @@ -2950,11 +2946,9 @@ bool CBasePlayer::Restore(CRestore& restore)
m_ClientSndRoomtype = -1;

// Reset room type on level change.
if (!FStrEq(STRING(m_MapName), STRING(gpGlobals->mapname)))
if (!FStrEq(restore.GetData().szCurrentMapName, STRING(gpGlobals->mapname)))
{
m_SndRoomtype = 0;

m_MapName = ALLOC_STRING(STRING(gpGlobals->mapname));
}

// Copied from spawn() for now
Expand Down
2 changes: 0 additions & 2 deletions dlls/player.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ class CBasePlayer : public CBaseMonster

int random_seed; // See that is shared between client & server for shared weapons code

string_t m_MapName; // Map the save game was made for, to detect level changes.

int m_iPlayerSound; // the index of the sound list slot reserved for this player
int m_iTargetVolume; // ideal sound volume.
int m_iWeaponVolume; // how loud the player's weapon is right now.
Expand Down
2 changes: 2 additions & 0 deletions dlls/saverestore.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class CSaveRestoreBuffer

unsigned short TokenHash(const char* pszToken);

const SAVERESTOREDATA& GetData() const { return m_data; }

//Data is only valid if it's a valid pointer and if it has a token list
[[nodiscard]] static bool IsValidSaveRestoreData(SAVERESTOREDATA* data)
{
Expand Down

0 comments on commit c72ea5b

Please sign in to comment.