Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/ps/scripting/JSInterface_SavedGame.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | JS::Value JSI_SavedGame::StartSavedGame(ScriptInterface::CmptPrivate* pCmptPrivate, const std::wstring& name) | ||||
g_Game = new CGame(true); | g_Game = new CGame(true); | ||||
{ | { | ||||
CSimulation2* sim = g_Game->GetSimulation2(); | CSimulation2* sim = g_Game->GetSimulation2(); | ||||
ScriptInterface::Request rqGame(sim->GetScriptInterface()); | ScriptInterface::Request rqGame(sim->GetScriptInterface()); | ||||
JS::RootedValue gameContextMetadata(rqGame.cx, | JS::RootedValue gameContextMetadata(rqGame.cx, | ||||
sim->GetScriptInterface().CloneValueFromOtherContext(*(pCmptPrivate->pScriptInterface), guiContextMetadata)); | sim->GetScriptInterface().CloneValueFromOtherCompartment(*(pCmptPrivate->pScriptInterface), guiContextMetadata)); | ||||
JS::RootedValue gameInitAttributes(rqGame.cx); | JS::RootedValue gameInitAttributes(rqGame.cx); | ||||
sim->GetScriptInterface().GetProperty(gameContextMetadata, "initAttributes", &gameInitAttributes); | sim->GetScriptInterface().GetProperty(gameContextMetadata, "initAttributes", &gameInitAttributes); | ||||
int playerID; | int playerID; | ||||
sim->GetScriptInterface().GetProperty(gameContextMetadata, "playerID", playerID); | sim->GetScriptInterface().GetProperty(gameContextMetadata, "playerID", playerID); | ||||
g_Game->SetPlayerID(playerID); | g_Game->SetPlayerID(playerID); | ||||
g_Game->StartGame(&gameInitAttributes, savedState); | g_Game->StartGame(&gameInitAttributes, savedState); | ||||
Show All 15 Lines |
Wildfire Games · Phabricator