From d23729e6e16ac8d0bcb9756e12afd12825e334aa Mon Sep 17 00:00:00 2001 From: James Mitchell Date: Sat, 23 Jan 2021 13:54:00 +1100 Subject: [PATCH] Fixing issue with loading from a save on game start crashing --- sp/src/public/vscript/ivscript.h | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/sp/src/public/vscript/ivscript.h b/sp/src/public/vscript/ivscript.h index fb3a1b79..39657e01 100644 --- a/sp/src/public/vscript/ivscript.h +++ b/sp/src/public/vscript/ivscript.h @@ -695,27 +695,13 @@ struct ScriptEnumDesc_t #define BEGIN_SCRIPTDESC( className, baseClass, description ) BEGIN_SCRIPTDESC_NAMED( className, baseClass, #className, description ) #define BEGIN_SCRIPTDESC_ROOT( className, description ) BEGIN_SCRIPTDESC_ROOT_NAMED( className, #className, description ) -#ifdef MSVC - #define DEFINE_SCRIPTDESC_FUNCTION( className, baseClass ) \ - ScriptClassDesc_t * GetScriptDesc( className * ) -#else - #define DEFINE_SCRIPTDESC_FUNCTION( className, baseClass ) \ - template <> ScriptClassDesc_t * GetScriptDesc( baseClass *); \ - template <> ScriptClassDesc_t * GetScriptDesc( className *) -#endif - #define BEGIN_SCRIPTDESC_NAMED( className, baseClass, scriptName, description ) \ - ScriptClassDesc_t g_##className##_ScriptDesc; \ - DEFINE_SCRIPTDESC_FUNCTION( className, baseClass ) \ + template <> ScriptClassDesc_t* GetScriptDesc(baseClass*); \ + template <> ScriptClassDesc_t* GetScriptDesc(className*); \ + ScriptClassDesc_t & g_##className##_ScriptDesc = *GetScriptDesc(nullptr); \ + template <> ScriptClassDesc_t* GetScriptDesc(className*) \ { \ - static bool bInitialized; \ - if ( bInitialized ) \ - { \ - return &g_##className##_ScriptDesc; \ - } \ - \ - bInitialized = true; \ - \ + static ScriptClassDesc_t g_##className##_ScriptDesc; \ typedef className _className; \ ScriptClassDesc_t *pDesc = &g_##className##_ScriptDesc; \ pDesc->m_pszDescription = description; \