diff --git a/Client/mods/deathmatch/CClient.cpp b/Client/mods/deathmatch/CClient.cpp index ab4cb37e7d..6f3ae78874 100644 --- a/Client/mods/deathmatch/CClient.cpp +++ b/Client/mods/deathmatch/CClient.cpp @@ -20,6 +20,7 @@ CGame* g_pGame = NULL; CMultiplayer* g_pMultiplayer = NULL; CNet* g_pNet = NULL; CClientGame* g_pClientGame = NULL; +CClientGame* g_pSharedGame = nullptr; int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore) { @@ -138,6 +139,7 @@ int CClient::ClientInitialize(const char* szArguments, CCoreInterface* pCore) { // Create new clientgame g_pClientGame = new CClientGame(true); + g_pSharedGame = g_pClientGame; // Connect g_pCore->GetConsole()->Echo("Starting playback..."); @@ -205,6 +207,7 @@ void CClient::ClientShutdown() { delete g_pClientGame; g_pClientGame = NULL; + g_pSharedGame = nullptr; } } diff --git a/Client/mods/deathmatch/ClientCommands.cpp b/Client/mods/deathmatch/ClientCommands.cpp index fcfa02b390..39e48f01f6 100644 --- a/Client/mods/deathmatch/ClientCommands.cpp +++ b/Client/mods/deathmatch/ClientCommands.cpp @@ -27,8 +27,6 @@ using std::vector; // Hide the "conversion from 'unsigned long' to 'DWORD*' of greater size" warning #pragma warning(disable:4312) -extern CClientGame* g_pClientGame; - bool COMMAND_Executed(const char* szCommand, const char* szArguments, bool bHandleRemotely, bool bHandled, bool bIsScriptedBind) { // Has the core already handled this command? diff --git a/Client/mods/deathmatch/logic/CClient3DMarker.cpp b/Client/mods/deathmatch/logic/CClient3DMarker.cpp index 5f04bc5fe7..19e4c0c7bd 100644 --- a/Client/mods/deathmatch/logic/CClient3DMarker.cpp +++ b/Client/mods/deathmatch/logic/CClient3DMarker.cpp @@ -12,8 +12,6 @@ #include #include -extern CClientGame* g_pClientGame; - CClient3DMarker::CClient3DMarker(CClientMarker* pThis) { // Init diff --git a/Client/mods/deathmatch/logic/CClientEntity.cpp b/Client/mods/deathmatch/logic/CClientEntity.cpp index 849f218e25..0ef8f9790b 100644 --- a/Client/mods/deathmatch/logic/CClientEntity.cpp +++ b/Client/mods/deathmatch/logic/CClientEntity.cpp @@ -12,8 +12,6 @@ using std::list; -extern CClientGame* g_pClientGame; - #pragma warning( disable : 4355 ) // warning C4355: 'this' : used in base member initializer list CClientEntity::CClientEntity(ElementID ID) : ClassInit(this) diff --git a/Client/mods/deathmatch/logic/CClientExplosionManager.cpp b/Client/mods/deathmatch/logic/CClientExplosionManager.cpp index 8e79c61f50..3f9fb516a0 100644 --- a/Client/mods/deathmatch/logic/CClientExplosionManager.cpp +++ b/Client/mods/deathmatch/logic/CClientExplosionManager.cpp @@ -11,8 +11,6 @@ #include #include -extern CClientGame* g_pClientGame; - CClientExplosionManager* g_pExplosionManager = NULL; CClientExplosionManager::CClientExplosionManager(CClientManager* pManager) diff --git a/Client/mods/deathmatch/logic/CClientGUIElement.cpp b/Client/mods/deathmatch/logic/CClientGUIElement.cpp index fdb981da33..ed4f46705a 100644 --- a/Client/mods/deathmatch/logic/CClientGUIElement.cpp +++ b/Client/mods/deathmatch/logic/CClientGUIElement.cpp @@ -12,8 +12,6 @@ using std::list; -extern CClientGame* g_pClientGame; - CClientGUIElement::CClientGUIElement(CClientManager* pManager, CLuaMain* pLuaMain, CGUIElement* pCGUIElement, ElementID ID) : ClassInit(this), CClientEntity(ID) { m_pManager = pManager; diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 03e5057264..055ffafb10 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -51,7 +51,6 @@ using std::vector; #pragma warning(disable:4312) // Used within this file by the packet handler to grab the this pointer of CClientGame -extern CClientGame* g_pClientGame; extern int g_iDamageEventLimit; float g_fApplyDamageLastAmount; uchar g_ucApplyDamageLastHitZone; diff --git a/Client/mods/deathmatch/logic/CClientGame.h b/Client/mods/deathmatch/logic/CClientGame.h index 54fe30a030..aecd7aff67 100644 --- a/Client/mods/deathmatch/logic/CClientGame.h +++ b/Client/mods/deathmatch/logic/CClientGame.h @@ -848,3 +848,4 @@ class CClientGame }; extern CClientGame* g_pClientGame; +extern CClientGame* g_pSharedGame; diff --git a/Client/mods/deathmatch/logic/CClientManager.cpp b/Client/mods/deathmatch/logic/CClientManager.cpp index 21962cc8f3..e5c99ba535 100644 --- a/Client/mods/deathmatch/logic/CClientManager.cpp +++ b/Client/mods/deathmatch/logic/CClientManager.cpp @@ -12,8 +12,6 @@ using SharedUtil::CalcMTASAPath; -extern CClientGame* g_pClientGame; - CClientManager::CClientManager() { m_pMarkerStreamer = new CClientStreamer(CClientMarker::IsLimitReached, 600.0f, 300, 300); diff --git a/Client/mods/deathmatch/logic/CClientMarker.cpp b/Client/mods/deathmatch/logic/CClientMarker.cpp index d193ab1823..45a06666c3 100644 --- a/Client/mods/deathmatch/logic/CClientMarker.cpp +++ b/Client/mods/deathmatch/logic/CClientMarker.cpp @@ -10,8 +10,6 @@ #include "StdInc.h" -extern CClientGame* g_pClientGame; - #ifndef M_PI #define M_PI 3.14159265358979323846 #endif diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 1eaaa5c796..8d0100351e 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -35,8 +35,6 @@ using std::list; using std::vector; -extern CClientGame* g_pClientGame; - #ifndef M_PI #define M_PI 3.14159265358979323846 #endif @@ -3333,7 +3331,6 @@ void CClientPed::SetTargetRotation(unsigned long ulDelay, float fRotation, float // Temporary #include "../mods/deathmatch/logic/CClientGame.h" -extern CClientGame* g_pClientGame; void CClientPed::Interpolate() { diff --git a/Client/mods/deathmatch/logic/CClientPickup.cpp b/Client/mods/deathmatch/logic/CClientPickup.cpp index 581f78a6fc..b671dd94ba 100644 --- a/Client/mods/deathmatch/logic/CClientPickup.cpp +++ b/Client/mods/deathmatch/logic/CClientPickup.cpp @@ -12,8 +12,6 @@ #include #include -extern CClientGame* g_pClientGame; - CClientPickup::CClientPickup(CClientManager* pManager, ElementID ID, unsigned short usModel, CVector vecPosition) : ClassInit(this), CClientStreamElement(pManager->GetPickupStreamer(), ID) { diff --git a/Client/mods/deathmatch/logic/CClientStreamer.cpp b/Client/mods/deathmatch/logic/CClientStreamer.cpp index e0aff6d352..f8914d7b08 100644 --- a/Client/mods/deathmatch/logic/CClientStreamer.cpp +++ b/Client/mods/deathmatch/logic/CClientStreamer.cpp @@ -108,7 +108,6 @@ void CClientStreamer::ConnectRow(CClientStreamSectorRow* pRow) } #include "..\deathmatch\logic\CClientGame.h" -extern CClientGame* g_pClientGame; void CClientStreamer::DoPulse(CVector& vecPosition) { /* Debug code diff --git a/Client/mods/deathmatch/logic/CDeathmatchObject.cpp b/Client/mods/deathmatch/logic/CDeathmatchObject.cpp index c1712246fb..ade5bc919a 100644 --- a/Client/mods/deathmatch/logic/CDeathmatchObject.cpp +++ b/Client/mods/deathmatch/logic/CDeathmatchObject.cpp @@ -13,8 +13,6 @@ using std::list; -extern CClientGame* g_pClientGame; - #ifdef WITH_OBJECT_SYNC CDeathmatchObject::CDeathmatchObject(CClientManager* pManager, CMovingObjectsManager* pMovingObjectsManager, CObjectSync* pObjectSync, ElementID ID, unsigned short usModel) diff --git a/Client/mods/deathmatch/logic/CElementGroup.cpp b/Client/mods/deathmatch/logic/CElementGroup.cpp index 17e5e542e7..5d8a67ec19 100644 --- a/Client/mods/deathmatch/logic/CElementGroup.cpp +++ b/Client/mods/deathmatch/logic/CElementGroup.cpp @@ -20,8 +20,6 @@ using std::list; -extern CClientGame* g_pClientGame; - CElementGroup::~CElementGroup() { CElementDeleter* deleter = g_pClientGame->GetElementDeleter(); @@ -49,4 +47,4 @@ void CElementGroup::Remove(class CClientEntity* element) unsigned int CElementGroup::GetCount() { return m_elements.size(); -} \ No newline at end of file +} diff --git a/Client/mods/deathmatch/logic/CNetAPI.cpp b/Client/mods/deathmatch/logic/CNetAPI.cpp index ecb16fd1ac..9ef7c04484 100644 --- a/Client/mods/deathmatch/logic/CNetAPI.cpp +++ b/Client/mods/deathmatch/logic/CNetAPI.cpp @@ -15,7 +15,6 @@ #include #include -extern CClientGame* g_pClientGame; CTickRateSettings g_TickRateSettings; CNetAPI::CNetAPI(CClientManager* pManager) diff --git a/Client/mods/deathmatch/logic/CPedSync.cpp b/Client/mods/deathmatch/logic/CPedSync.cpp index d11e8f526f..a75d4e4612 100644 --- a/Client/mods/deathmatch/logic/CPedSync.cpp +++ b/Client/mods/deathmatch/logic/CPedSync.cpp @@ -13,8 +13,6 @@ using std::list; -extern CClientGame* g_pClientGame; - #define PED_SYNC_RATE ( g_TickRateSettings.iPedSync ) CPedSync::CPedSync(CClientPedManager* pPedManager) diff --git a/Client/mods/deathmatch/logic/CResource.cpp b/Client/mods/deathmatch/logic/CResource.cpp index ee9a44dc42..8e973dafd1 100644 --- a/Client/mods/deathmatch/logic/CResource.cpp +++ b/Client/mods/deathmatch/logic/CResource.cpp @@ -16,8 +16,6 @@ using namespace std; -extern CClientGame* g_pClientGame; - int CResource::m_iShowingCursor = 0; CResource::CResource(unsigned short usNetID, const char* szResourceName, CClientEntity* pResourceEntity, CClientEntity* pResourceDynamicEntity, diff --git a/Client/mods/deathmatch/logic/CUnoccupiedVehicleSync.cpp b/Client/mods/deathmatch/logic/CUnoccupiedVehicleSync.cpp index e64cd30a22..886418b5fe 100644 --- a/Client/mods/deathmatch/logic/CUnoccupiedVehicleSync.cpp +++ b/Client/mods/deathmatch/logic/CUnoccupiedVehicleSync.cpp @@ -14,8 +14,6 @@ using std::list; -extern CClientGame* g_pClientGame; - #define UNOCCUPIED_VEHICLE_SYNC_RATE ( g_TickRateSettings.iUnoccupiedVehicle ) CUnoccupiedVehicleSync::CUnoccupiedVehicleSync(CClientVehicleManager* pVehicleManager) diff --git a/Client/mods/deathmatch/logic/lua/CLuaArgument.cpp b/Client/mods/deathmatch/logic/lua/CLuaArgument.cpp index 3a5f50df3f..8df5e1b437 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaArgument.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaArgument.cpp @@ -22,8 +22,6 @@ #define VERIFY_RESOURCE(resource) (g_pClientGame->GetResourceManager()->Exists(resource)) #endif -extern CClientGame* g_pClientGame; - using namespace std; // Prevent the warning issued when doing unsigned short -> void* diff --git a/Client/mods/deathmatch/logic/lua/CLuaArguments.cpp b/Client/mods/deathmatch/logic/lua/CLuaArguments.cpp index c93cc86bb4..c1c11e3691 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaArguments.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaArguments.cpp @@ -18,8 +18,6 @@ using namespace std; #define VERIFY_ENTITY(entity) (CStaticFunctionDefinitions::GetRootElement()->IsMyChild(entity,true)&&!entity->IsBeingDeleted()) #endif -extern CClientGame* g_pClientGame; - CLuaArguments::CLuaArguments(NetBitStreamInterface& bitStream, std::vector* pKnownTables) { ReadFromBitStream(bitStream, pKnownTables); diff --git a/Client/mods/deathmatch/logic/lua/CLuaMain.cpp b/Client/mods/deathmatch/logic/lua/CLuaMain.cpp index 4dbe913aa0..93ed6fc7f5 100644 --- a/Client/mods/deathmatch/logic/lua/CLuaMain.cpp +++ b/Client/mods/deathmatch/logic/lua/CLuaMain.cpp @@ -15,8 +15,6 @@ using std::list; -extern CClientGame* g_pClientGame; - static CLuaManager* m_pLuaManager; SString CLuaMain::ms_strExpectedUndumpHash; diff --git a/Server/mods/deathmatch/logic/CClient.cpp b/Server/mods/deathmatch/logic/CClient.cpp index cb1a3dcb7b..e6f762c7a8 100644 --- a/Server/mods/deathmatch/logic/CClient.cpp +++ b/Server/mods/deathmatch/logic/CClient.cpp @@ -14,8 +14,6 @@ #include "CGame.h" #include "CAccountManager.h" -extern CGame* g_pGame; - CClient::CClient(bool bAddGuestAccount) { if (bAddGuestAccount) diff --git a/Server/mods/deathmatch/logic/CConsoleCommands.cpp b/Server/mods/deathmatch/logic/CConsoleCommands.cpp index 119f09af1d..1c344089d8 100644 --- a/Server/mods/deathmatch/logic/CConsoleCommands.cpp +++ b/Server/mods/deathmatch/logic/CConsoleCommands.cpp @@ -25,8 +25,6 @@ #include "CGame.h" #include "CMainConfig.h" -extern CGame* g_pGame; - // Helper functions static std::string GetAdminNameForLog(CClient* pClient) { @@ -825,7 +823,6 @@ bool CConsoleCommands::Nick(CConsole* pConsole, const char* szArguments, CClient // HACKED IN FOR NOW #include "CGame.h" -extern CGame* g_pGame; bool CConsoleCommands::LogIn(CConsole* pConsole, const char* szArguments, CClient* pClient, CClient* pEchoClient) { diff --git a/Server/mods/deathmatch/logic/CElement.cpp b/Server/mods/deathmatch/logic/CElement.cpp index 59086a2f14..0d163f9945 100644 --- a/Server/mods/deathmatch/logic/CElement.cpp +++ b/Server/mods/deathmatch/logic/CElement.cpp @@ -27,8 +27,6 @@ #include "Utils.h" #include "lua/CLuaFunctionParseHelpers.h" -extern CGame* g_pGame; - #if defined(_MSC_VER) #pragma warning(disable : 4355) // warning C4355: 'this' : used in base member initializer list #endif diff --git a/Server/mods/deathmatch/logic/CElementDeleter.cpp b/Server/mods/deathmatch/logic/CElementDeleter.cpp index 9b4838a89c..0e421ccdf9 100644 --- a/Server/mods/deathmatch/logic/CElementDeleter.cpp +++ b/Server/mods/deathmatch/logic/CElementDeleter.cpp @@ -13,8 +13,6 @@ #include "CElementDeleter.h" #include "CGame.h" -extern CGame* g_pGame; - void CElementDeleter::Delete(class CElement* pElement, bool bUnlink, bool bUpdatePerPlayerEntities) { if (pElement) diff --git a/Server/mods/deathmatch/logic/CElementGroup.cpp b/Server/mods/deathmatch/logic/CElementGroup.cpp index 2f7f9009fc..a6d71ab6c7 100644 --- a/Server/mods/deathmatch/logic/CElementGroup.cpp +++ b/Server/mods/deathmatch/logic/CElementGroup.cpp @@ -23,8 +23,6 @@ #include "CMapManager.h" #include "CPerPlayerEntity.h" -extern CGame* g_pGame; - CElementGroup::~CElementGroup() { // Delete all the elements diff --git a/Server/mods/deathmatch/logic/CGame.cpp b/Server/mods/deathmatch/logic/CGame.cpp index 739b54098a..5a73ee7375 100644 --- a/Server/mods/deathmatch/logic/CGame.cpp +++ b/Server/mods/deathmatch/logic/CGame.cpp @@ -86,6 +86,7 @@ #endif CGame* g_pGame = NULL; +CGame* g_pSharedGame = NULL; char szProgress[4] = {'-', '\\', '|', '/'}; unsigned char ucProgress = 0; @@ -146,6 +147,7 @@ CGame::CGame() : m_FloodProtect(4, 30000, 30000) // Max of 4 connecti { // Set our global pointer g_pGame = this; + g_pSharedGame = g_pGame; m_bServerFullyUp = false; diff --git a/Server/mods/deathmatch/logic/CGame.h b/Server/mods/deathmatch/logic/CGame.h index 122a9a38e3..1945db0537 100644 --- a/Server/mods/deathmatch/logic/CGame.h +++ b/Server/mods/deathmatch/logic/CGame.h @@ -656,3 +656,6 @@ class CGame bool m_DevelopmentModeEnabled; bool m_showClientTransferBox = true; }; + +extern CGame* g_pGame; +extern CGame* g_pSharedGame; diff --git a/Server/mods/deathmatch/logic/CHTTPD.cpp b/Server/mods/deathmatch/logic/CHTTPD.cpp index 75734237f2..75d07de083 100644 --- a/Server/mods/deathmatch/logic/CHTTPD.cpp +++ b/Server/mods/deathmatch/logic/CHTTPD.cpp @@ -24,8 +24,6 @@ #include #endif -extern CGame* g_pGame; - CHTTPD::CHTTPD() : m_BruteForceProtect(4, 30000, 60000 * 5) // Max of 4 attempts per 30 seconds, then 5 minute ignore , diff --git a/Server/mods/deathmatch/logic/CMainConfig.cpp b/Server/mods/deathmatch/logic/CMainConfig.cpp index be32e6c9eb..8a78b23a4d 100644 --- a/Server/mods/deathmatch/logic/CMainConfig.cpp +++ b/Server/mods/deathmatch/logic/CMainConfig.cpp @@ -24,8 +24,6 @@ #define MTA_SERVER_CONF_TEMPLATE "mtaserver.conf.template" -extern CGame* g_pGame; - CBandwidthSettings* g_pBandwidthSettings = new CBandwidthSettings(); CTickRateSettings g_TickRateSettings; diff --git a/Server/mods/deathmatch/logic/CMapManager.cpp b/Server/mods/deathmatch/logic/CMapManager.cpp index 0af22ff885..a9479c5c7f 100644 --- a/Server/mods/deathmatch/logic/CMapManager.cpp +++ b/Server/mods/deathmatch/logic/CMapManager.cpp @@ -28,8 +28,6 @@ #include "packets/CPickupHideShowPacket.h" #include "packets/CVehicleSpawnPacket.h" -extern CGame* g_pGame; - CMapManager::CMapManager(CBlipManager* pBlipManager, CObjectManager* pObjectManager, CPickupManager* pPickupManager, CPlayerManager* pPlayerManager, CRadarAreaManager* pRadarAreaManager, CMarkerManager* pMarkerManager, CVehicleManager* pVehicleManager, CTeamManager* pTeamManager, CPedManager* pPedManager, CColManager* pColManager, CWaterManager* pWaterManager, CClock* pClock, CGroups* pGroups, CEvents* pEvents, diff --git a/Server/mods/deathmatch/logic/CObject.cpp b/Server/mods/deathmatch/logic/CObject.cpp index c88dbf3e60..0eecee086e 100644 --- a/Server/mods/deathmatch/logic/CObject.cpp +++ b/Server/mods/deathmatch/logic/CObject.cpp @@ -14,8 +14,6 @@ #include "CLogger.h" #include "Utils.h" -extern CGame* g_pGame; - CObject::CObject(CElement* pParent, CObjectManager* pObjectManager, bool bIsLowLod) : CElement(pParent), m_bIsLowLod(bIsLowLod), m_pLowLodObject(NULL) { // Init diff --git a/Server/mods/deathmatch/logic/CPickup.cpp b/Server/mods/deathmatch/logic/CPickup.cpp index cb9e8350f7..d712b4adb6 100644 --- a/Server/mods/deathmatch/logic/CPickup.cpp +++ b/Server/mods/deathmatch/logic/CPickup.cpp @@ -18,8 +18,6 @@ #include "packets/CPickupHitConfirmPacket.h" #include "CStaticFunctionDefinitions.h" -extern CGame* g_pGame; - CPickup::CPickup(CElement* pParent, CPickupManager* pPickupManager, CColManager* pColManager) : CElement(pParent) { // Init diff --git a/Server/mods/deathmatch/logic/CPlayer.cpp b/Server/mods/deathmatch/logic/CPlayer.cpp index 5d4fee6401..8655c37e34 100644 --- a/Server/mods/deathmatch/logic/CPlayer.cpp +++ b/Server/mods/deathmatch/logic/CPlayer.cpp @@ -29,8 +29,6 @@ #include "CSpatialDatabase.h" #include "net/SimHeaders.h" -extern CGame* g_pGame; - CPlayer::CPlayer(CPlayerManager* pPlayerManager, class CScriptDebugging* pScriptDebugging, const NetServerPlayerID& PlayerSocket) : CPed(nullptr, nullptr, 0) { CElementRefManager::AddElementRefs(ELEMENT_REF_DEBUG(this, "CPlayer"), &m_pTeam, NULL); diff --git a/Server/mods/deathmatch/logic/CResourceClientFileItem.cpp b/Server/mods/deathmatch/logic/CResourceClientFileItem.cpp index a86341248e..c5417965af 100644 --- a/Server/mods/deathmatch/logic/CResourceClientFileItem.cpp +++ b/Server/mods/deathmatch/logic/CResourceClientFileItem.cpp @@ -15,8 +15,6 @@ #include "StdInc.h" #include "CResourceClientFileItem.h" -extern CGame* g_pGame; - CResourceClientFileItem::CResourceClientFileItem(CResource* resource, const char* szShortName, const char* szResourceFileName, CXMLAttributes* xmlAttributes, bool bClientAutoDownload) : CResourceFile(resource, szShortName, szResourceFileName, xmlAttributes) diff --git a/Server/mods/deathmatch/logic/CResourceClientScriptItem.cpp b/Server/mods/deathmatch/logic/CResourceClientScriptItem.cpp index cf5426b955..955b6295dc 100644 --- a/Server/mods/deathmatch/logic/CResourceClientScriptItem.cpp +++ b/Server/mods/deathmatch/logic/CResourceClientScriptItem.cpp @@ -18,8 +18,6 @@ #include "CScriptDebugging.h" #include -extern CGame* g_pGame; - CResourceClientScriptItem::CResourceClientScriptItem(CResource* resource, const char* szShortName, const char* szResourceFileName, CXMLAttributes* xmlAttributes) : CResourceFile(resource, szShortName, szResourceFileName, xmlAttributes) diff --git a/Server/mods/deathmatch/logic/CResourceMapItem.cpp b/Server/mods/deathmatch/logic/CResourceMapItem.cpp index 653d192ac2..8715353985 100644 --- a/Server/mods/deathmatch/logic/CResourceMapItem.cpp +++ b/Server/mods/deathmatch/logic/CResourceMapItem.cpp @@ -24,8 +24,6 @@ #include "Enums.h" #include "lua/CLuaFunctionParseHelpers.h" -extern CGame* g_pGame; - CResourceMapItem::CResourceMapItem(CResource* pResource, const char* szShortName, const char* szResourceFileName, CXMLAttributes* pXMLAttributes, int iDimension) : CResourceFile(pResource, szShortName, szResourceFileName, pXMLAttributes) diff --git a/Server/mods/deathmatch/logic/CScriptDebugging.cpp b/Server/mods/deathmatch/logic/CScriptDebugging.cpp index 45a131374e..2ed1af934d 100644 --- a/Server/mods/deathmatch/logic/CScriptDebugging.cpp +++ b/Server/mods/deathmatch/logic/CScriptDebugging.cpp @@ -13,8 +13,6 @@ #include "CScriptDebugging.h" #include "packets/CDebugEchoPacket.h" -extern CGame* g_pGame; - CScriptDebugging::CScriptDebugging() { m_uiLogFileLevel = 0; diff --git a/Server/mods/deathmatch/logic/CVehicle.cpp b/Server/mods/deathmatch/logic/CVehicle.cpp index ee5f7eb0e6..def66693db 100644 --- a/Server/mods/deathmatch/logic/CVehicle.cpp +++ b/Server/mods/deathmatch/logic/CVehicle.cpp @@ -19,8 +19,6 @@ #include "CBandwidthSettings.h" #include "Utils.h" -extern CGame* g_pGame; - CVehicle::CVehicle(CVehicleManager* pVehicleManager, CElement* pParent, unsigned short usModel, unsigned char ucVariant, unsigned char ucVariant2) : CElement(pParent) { diff --git a/Server/mods/deathmatch/logic/lua/CLuaArgument.cpp b/Server/mods/deathmatch/logic/lua/CLuaArgument.cpp index 6c2f02c377..eff8107acd 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaArgument.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaArgument.cpp @@ -18,8 +18,6 @@ #include "CScriptDebugging.h" #include "CResourceManager.h" -extern CGame* g_pGame; - #ifndef VERIFY_ELEMENT #define VERIFY_ELEMENT(element) (g_pGame->GetMapManager()->GetRootElement ()->IsMyChild(element,true)&&!element->IsBeingDeleted()) #endif diff --git a/Server/mods/deathmatch/logic/lua/CLuaArguments.cpp b/Server/mods/deathmatch/logic/lua/CLuaArguments.cpp index 3feadfeedb..54f482bb18 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaArguments.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaArguments.cpp @@ -25,8 +25,6 @@ #include #endif -extern CGame* g_pGame; - #ifndef VERIFY_ELEMENT #define VERIFY_ELEMENT(element) (g_pGame->GetMapManager()->GetRootElement()->IsMyChild(element, true) && !element->IsBeingDeleted()) #endif diff --git a/Server/mods/deathmatch/logic/lua/CLuaManager.cpp b/Server/mods/deathmatch/logic/lua/CLuaManager.cpp index 52d25e8b8f..f4a8e8cf1a 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaManager.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaManager.cpp @@ -43,8 +43,6 @@ #include "luadefs/CLuaWorldDefs.h" #include "luadefs/CLuaCompatibilityDefs.h" -extern CGame* g_pGame; - CLuaManager::CLuaManager(CObjectManager* pObjectManager, CPlayerManager* pPlayerManager, CVehicleManager* pVehicleManager, CBlipManager* pBlipManager, CRadarAreaManager* pRadarAreaManager, CRegisteredCommands* pRegisteredCommands, CMapManager* pMapManager, CEvents* pEvents) { diff --git a/Server/mods/deathmatch/logic/lua/CLuaModule.cpp b/Server/mods/deathmatch/logic/lua/CLuaModule.cpp index 14745e55b7..7691265aa1 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaModule.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaModule.cpp @@ -17,8 +17,6 @@ #include "CGame.h" #include "CResourceManager.h" -extern CGame* g_pGame; - CLuaModule::CLuaModule(CLuaModuleManager* pLuaModuleManager, CScriptDebugging* pScriptDebugging, const char* szFileName, const char* szShortFileName) { // Set module manager diff --git a/Server/mods/deathmatch/logic/lua/CLuaModuleManager.cpp b/Server/mods/deathmatch/logic/lua/CLuaModuleManager.cpp index 298faa27af..ad8f98007e 100644 --- a/Server/mods/deathmatch/logic/lua/CLuaModuleManager.cpp +++ b/Server/mods/deathmatch/logic/lua/CLuaModuleManager.cpp @@ -14,8 +14,6 @@ #include "StdInc.h" #include "CLuaModuleManager.h" -extern CGame* g_pGame; - CLuaModuleManager::CLuaModuleManager(CLuaManager* pLuaManager) { m_pLuaManager = pLuaManager; diff --git a/Server/mods/deathmatch/logic/lua/LuaCommon.cpp b/Server/mods/deathmatch/logic/lua/LuaCommon.cpp index 553121be40..e5ebae7651 100644 --- a/Server/mods/deathmatch/logic/lua/LuaCommon.cpp +++ b/Server/mods/deathmatch/logic/lua/LuaCommon.cpp @@ -18,8 +18,6 @@ #include "lua/CLuaShared.h" #include "luadefs/CLuaClassDefs.h" -extern CGame* g_pGame; - // Lua push/pop macros for our datatypes CElement* lua_toelement(lua_State* luaVM, int iArgument) { diff --git a/Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp b/Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp index 3765f22980..1b679adf17 100644 --- a/Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CPlayerPuresyncPacket.cpp @@ -16,8 +16,6 @@ #include "Utils.h" #include -extern CGame* g_pGame; - CPlayerPuresyncPacket::CPlayerPuresyncPacket(CPlayer* pPlayer) { m_pSourceElement = pPlayer; diff --git a/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp b/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp index 67bc9574be..770b79517d 100644 --- a/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp +++ b/Server/mods/deathmatch/logic/packets/CVehiclePuresyncPacket.cpp @@ -19,8 +19,6 @@ #include "lua/CLuaFunctionParseHelpers.h" #include "net/SyncStructures.h" -extern CGame* g_pGame; - CVehiclePuresyncPacket::CVehiclePuresyncPacket(CPlayer* pPlayer) { m_pSourceElement = pPlayer; diff --git a/Shared/mods/deathmatch/logic/CScriptDebugging.cpp b/Shared/mods/deathmatch/logic/CScriptDebugging.cpp index 8b66520b1a..d3191c4e23 100644 --- a/Shared/mods/deathmatch/logic/CScriptDebugging.cpp +++ b/Shared/mods/deathmatch/logic/CScriptDebugging.cpp @@ -235,6 +235,7 @@ void CScriptDebugging::LogString(const char* szPrePend, const SLuaDebugInfo& lua notCancelled = g_pClientGame->GetRootEntity()->CallEvent("onClientDebugMessage", Arguments, false); #else notCancelled = g_pGame->GetMapManager()->GetRootElement()->CallEvent("onDebugMessage", Arguments); + #endif // Reset trigger state, so onDebugMessage can be called again at a later moment diff --git a/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp b/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp index 1ca16ce6f4..6240bcab4d 100644 --- a/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp +++ b/Shared/mods/deathmatch/logic/lua/CLuaShared.cpp @@ -90,9 +90,5 @@ void CLuaShared::AddClasses(lua_State* luaVM) SharedUtil::CAsyncTaskScheduler* CLuaShared::GetAsyncTaskScheduler() { -#ifdef MTA_CLIENT - return g_pClientGame->GetAsyncTaskScheduler(); -#else - return g_pGame->GetAsyncTaskScheduler(); -#endif + return g_pSharedGame->GetAsyncTaskScheduler(); } diff --git a/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp b/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp index 98fd2005a9..d3e33d268e 100644 --- a/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp +++ b/Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp @@ -617,11 +617,7 @@ int CLuaUtilDefs::DebugSleep(lua_State* luaVM) if (!argStream.HasErrors()) { -#ifdef MTA_CLIENT - if (!g_pClientGame->GetDevelopmentMode()) -#else - if (!g_pGame->GetDevelopmentMode()) -#endif + if (!g_pSharedGame->GetDevelopmentMode()) { m_pScriptDebugging->LogError(luaVM, "This function can only be used in development mode"); lua_pushboolean(luaVM, false); @@ -629,11 +625,7 @@ int CLuaUtilDefs::DebugSleep(lua_State* luaVM) } // Process HTTP -#ifdef MTA_CLIENT - g_pClientGame->GetRemoteCalls()->ProcessQueuedFiles(); -#else - g_pGame->GetRemoteCalls()->ProcessQueuedFiles(); -#endif + g_pSharedGame->GetRemoteCalls()->ProcessQueuedFiles(); // Sleep a bit std::this_thread::sleep_for(std::chrono::milliseconds(milliseconds)); diff --git a/Shared/sdk/CScriptArgReader.h b/Shared/sdk/CScriptArgReader.h index f9d522e548..a4dbbe1f8c 100644 --- a/Shared/sdk/CScriptArgReader.h +++ b/Shared/sdk/CScriptArgReader.h @@ -1412,11 +1412,11 @@ class CScriptArgReader // Output warning here (there's no better way to integrate it without huge code changes if (!m_bError && !m_strCustomWarning.empty()) { - #ifdef MTA_CLIENT +#ifdef MTA_CLIENT CLuaFunctionDefs::m_pScriptDebugging->LogWarning(m_luaVM, m_strCustomWarning); - #else +#else g_pGame->GetScriptDebugging()->LogWarning(m_luaVM, m_strCustomWarning); - #endif +#endif m_strCustomWarning.clear(); }