From 043a7f5079cf464c8de9a41419aacefe24145202 Mon Sep 17 00:00:00 2001 From: Kiss Attila Date: Tue, 11 Nov 2014 23:14:42 +0100 Subject: [PATCH] Reduce memory usage of CPlayerData with bit-fields --- src/CPlayerData.h | 15 ++++++++------- src/Scripting.cpp | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/CPlayerData.h b/src/CPlayerData.h index dd2138e..1b6e290 100644 --- a/src/CPlayerData.h +++ b/src/CPlayerData.h @@ -72,10 +72,9 @@ class CPlayerData } stObj[MAX_OBJECTS]; WORD wPlayerID; - bool bObjectsRemoved; + float fGravity; BYTE byteWeather; - bool bWidescreen; float fBounds[4]; BYTE byteTeam; @@ -102,12 +101,14 @@ class CPlayerData PickupMap PlayerPickups; std::bitset bPlayerPickup; - bool bUpdateScoresPingsDisabled; - bool bFakePingToggle; DWORD dwFakePingValue; - - bool bAFKState; - bool bEverUpdated; DWORD dwLastUpdateTick; + + bool bObjectsRemoved : 1; + bool bWidescreen : 1; + bool bUpdateScoresPingsDisabled : 1; + bool bFakePingToggle : 1; + bool bAFKState : 1; + bool bEverUpdated : 1; }; #endif \ No newline at end of file diff --git a/src/Scripting.cpp b/src/Scripting.cpp index 438c05a..2dafb80 100644 --- a/src/Scripting.cpp +++ b/src/Scripting.cpp @@ -843,7 +843,7 @@ static cell AMX_NATIVE_CALL Natives::GetActiveTimers(AMX *amx, cell *params) return pNetGame->pScriptTimers->m_dwTimerCount; } -// native SendInvalidPlayerSync(playerid) - raksamp versions will crash +// native SendInvalidPlayerSync(playerid); - raksamp versions will crash static cell AMX_NATIVE_CALL Natives::SendInvalidPlayerSync(AMX *amx, cell *params) { // If unknown server version