MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / importScriptEngine

Method importScriptEngine

src/logic/ScriptEngine.cpp:492–509  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

490}
491
492void ScriptEngine::importScriptEngine(const json& j)
493{
494 auto& dat = m_pVM->getDATFile();
495
496 // j["globals"]: Array of 2 elements. [0]=SymbolName, [1]=Value
497
498 // Clear any value already inside
499 for (const json& p : j["globals"])
500 {
501 dat.getSymbolByName(p[0]).intData.clear();
502 }
503
504 // Assign imported values
505 for (const json& p : j["globals"])
506 {
507 dat.getSymbolByName(p[0]).intData.push_back(p[1]);
508 }
509}
510
511Handle::EntityHandle ScriptEngine::createDefaultPlayer(const std::string& symbolname)
512{

Callers 1

initMethod · 0.80

Calls 2

push_backMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected