diff --git a/Generals/Code/GameEngine/Include/Common/GlobalData.h b/Generals/Code/GameEngine/Include/Common/GlobalData.h index 6bdd10bc38..e4ed39b3a8 100644 --- a/Generals/Code/GameEngine/Include/Common/GlobalData.h +++ b/Generals/Code/GameEngine/Include/Common/GlobalData.h @@ -539,9 +539,15 @@ class GlobalData : public SubsystemInterface }; -// singleton -extern GlobalData* TheWritableGlobalData; - -#define TheGlobalData ((const GlobalData*)TheWritableGlobalData) +#if defined(_DEBUG) || defined(RTS_DEBUG) || defined(RTS_INTERNAL) + static union + { + GlobalData* TheWritableGlobalData; ///< The global data singleton + const GlobalData* TheGlobalData; ///< Const shorthand for above singleton + }; +#else + extern GlobalData* TheWritableGlobalData; ///< The global data singleton + #define TheGlobalData ((const GlobalData*)TheWritableGlobalData) ///< Const shorthand for above singleton +#endif #endif diff --git a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp index b3c407c02d..dfbacc200c 100644 --- a/Generals/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/Generals/Code/GameEngine/Source/Common/GlobalData.cpp @@ -56,7 +56,9 @@ #include "GameNetwork/FirewallHelper.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GlobalData* TheWritableGlobalData = NULL; ///< The global data singleton +#if !defined(_DEBUG) && !defined(RTS_DEBUG) && !defined(RTS_INTERNAL) + GlobalData* TheWritableGlobalData = NULL; ///< The global data singleton +#endif //------------------------------------------------------------------------------------------------- GlobalData* GlobalData::m_theOriginal = NULL; diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h index 5c7957e88f..2388df7468 100644 --- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h +++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h @@ -552,9 +552,15 @@ class GlobalData : public SubsystemInterface }; -// singleton -extern GlobalData* TheWritableGlobalData; - -#define TheGlobalData ((const GlobalData*)TheWritableGlobalData) +#if defined(_DEBUG) || defined(RTS_DEBUG) || defined(RTS_INTERNAL) + static union + { + GlobalData* TheWritableGlobalData; ///< The global data singleton + const GlobalData* TheGlobalData; ///< Const shorthand for above singleton + }; +#else + extern GlobalData* TheWritableGlobalData; ///< The global data singleton + #define TheGlobalData ((const GlobalData*)TheWritableGlobalData) ///< Const shorthand for above singleton +#endif #endif diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp index 83e33c3b61..85872e1248 100644 --- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp +++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp @@ -57,7 +57,9 @@ #include "GameNetwork/FirewallHelper.h" // PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GlobalData* TheWritableGlobalData = NULL; ///< The global data singleton +#if !defined(_DEBUG) && !defined(RTS_DEBUG) && !defined(RTS_INTERNAL) + GlobalData* TheWritableGlobalData = NULL; ///< The global data singleton +#endif //------------------------------------------------------------------------------------------------- GlobalData* GlobalData::m_theOriginal = NULL;