Move GlobalNamed.SetNameList call after Link() into Link()

It isn't clear whether that call is necessary since the C4AulScriptEngine
constructor already does this, but it is clear that duplicating the call
all over is a bad idea.
epoxy
Günther Brammer 2016-01-24 23:40:29 +01:00
parent 5be63d1e96
commit 9dadfba5af
5 changed files with 2 additions and 11 deletions

View File

@ -2426,9 +2426,6 @@ bool C4Game::LinkScriptEngine()
// update material pointers
::MaterialMap.UpdateScriptPointers();
// Set name list for globals
ScriptEngine.GlobalNamed.SetNameList(&ScriptEngine.GlobalNamedNames);
if (C4AulDebug *pDebug = C4AulDebug::GetDebugger())
if (!pDebug->Listen(DebugPort, !!DebugWait))

View File

@ -130,8 +130,6 @@ C4MapgenHandle* c4_mapgen_handle_new_script(const char* filename, const char* so
ScriptEngine.Link(&::Definitions);
if(c4_log_handle_get_n_log_messages() > 1)
throw std::runtime_error(c4_log_handle_get_first_log_message());
// Set name list for globals
ScriptEngine.GlobalNamed.SetNameList(&ScriptEngine.GlobalNamedNames);
// Generate map, fail if return error occurs
c4_log_handle_clear();
@ -248,8 +246,6 @@ C4MapgenHandle* c4_mapgen_handle_new(const char* filename, const char* source, c
ScriptEngine.Link(&::Definitions);
if(c4_log_handle_get_n_log_messages() > 1)
throw std::runtime_error(c4_log_handle_get_first_log_message());
// Set name list for globals
ScriptEngine.GlobalNamed.SetNameList(&ScriptEngine.GlobalNamedNames);
}
c4_log_handle_clear();

View File

@ -194,7 +194,8 @@ void C4AulScriptEngine::Link(C4DefList *rDefs)
err.show();
}
// Set name list for globals (FIXME: is this necessary?)
ScriptEngine.GlobalNamed.SetNameList(&ScriptEngine.GlobalNamedNames);
}

View File

@ -43,8 +43,6 @@ C4Value RunLoadedC4Script()
// Link script engine (resolve includes/appends, generate code)
ScriptEngine.Link(NULL);
// Set name list for globals
ScriptEngine.GlobalNamed.SetNameList(&ScriptEngine.GlobalNamedNames);
C4Value result = GameScript.Call("Main");
GameScript.Clear();
ScriptEngine.Clear();

View File

@ -58,7 +58,6 @@ C4Value AulTest::RunCode(const char *code, bool wrap)
GameScript.LoadData(src.c_str(), wrapped.c_str(), NULL);
ScriptEngine.Link(NULL);
ScriptEngine.GlobalNamed.SetNameList(&ScriptEngine.GlobalNamedNames);
return GameScript.Call("Main", nullptr, true);
}