make hack more surgical
This commit is contained in:
@@ -199,6 +199,18 @@ LuaManager::~LuaManager()
|
|||||||
lua_close( L );
|
lua_close( L );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LuaManager::RegisterTypes()
|
||||||
|
{
|
||||||
|
if( g_vRegisterActorTypes )
|
||||||
|
{
|
||||||
|
for( unsigned i=0; i<g_vRegisterActorTypes->size(); i++ )
|
||||||
|
{
|
||||||
|
RegisterActorFn fn = (*g_vRegisterActorTypes)[i];
|
||||||
|
fn( L );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void LuaManager::ResetState()
|
void LuaManager::ResetState()
|
||||||
{
|
{
|
||||||
if( L != NULL )
|
if( L != NULL )
|
||||||
@@ -222,14 +234,7 @@ void LuaManager::ResetState()
|
|||||||
for( const LuaFunctionList *p = g_LuaFunctions; p; p=p->next )
|
for( const LuaFunctionList *p = g_LuaFunctions; p; p=p->next )
|
||||||
lua_register( L, p->name, p->func );
|
lua_register( L, p->name, p->func );
|
||||||
|
|
||||||
if( g_vRegisterActorTypes )
|
RegisterTypes();
|
||||||
{
|
|
||||||
for( unsigned i=0; i<g_vRegisterActorTypes->size(); i++ )
|
|
||||||
{
|
|
||||||
RegisterActorFn fn = (*g_vRegisterActorTypes)[i];
|
|
||||||
fn( L );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
LuaReference::AfterResetAll();
|
LuaReference::AfterResetAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,9 @@ public:
|
|||||||
|
|
||||||
bool RunScriptFile( const CString &sFile );
|
bool RunScriptFile( const CString &sFile );
|
||||||
|
|
||||||
|
/* Register all subscribing types. There's no harm in registering when already registered. */
|
||||||
|
void RegisterTypes();
|
||||||
|
|
||||||
/* Reset the environment, freeing any globals left over by previously executed scripts. */
|
/* Reset the environment, freeing any globals left over by previously executed scripts. */
|
||||||
void ResetState();
|
void ResetState();
|
||||||
|
|
||||||
|
|||||||
@@ -1092,9 +1092,9 @@ int main(int argc, char* argv[])
|
|||||||
MESSAGEMAN = new MessageManager;
|
MESSAGEMAN = new MessageManager;
|
||||||
STATSMAN = new StatsManager;
|
STATSMAN = new StatsManager;
|
||||||
|
|
||||||
// UGLY: Reload the current theme now that all global singletons are
|
// UGLY: Now that all global singletons are constructed so that they, let them
|
||||||
// constructed so that they can be registered with Lua.
|
// all register with Lua.
|
||||||
THEME->UpdateLuaGlobals();
|
LUA->RegisterTypes();
|
||||||
|
|
||||||
SAFE_DELETE( loading_window ); // destroy this before init'ing Display
|
SAFE_DELETE( loading_window ); // destroy this before init'ing Display
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user