Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/components/CCmpCommandQueue.cpp
Show First 20 Lines • Show All 93 Lines • ▼ Show 20 Lines | virtual void PostNetworkCommand(JS::HandleValue cmd1) | ||||
// TODO: This is a workaround because we need to pass a MutableHandle to StringifyJSON. | // TODO: This is a workaround because we need to pass a MutableHandle to StringifyJSON. | ||||
JS::RootedValue cmd(cx, cmd1.get()); | JS::RootedValue cmd(cx, cmd1.get()); | ||||
PROFILE2_EVENT("post net command"); | PROFILE2_EVENT("post net command"); | ||||
PROFILE2_ATTR("command: %s", GetSimContext().GetScriptInterface().StringifyJSON(&cmd, false).c_str()); | PROFILE2_ATTR("command: %s", GetSimContext().GetScriptInterface().StringifyJSON(&cmd, false).c_str()); | ||||
// TODO: would be nicer to not use globals | // TODO: would be nicer to not use globals | ||||
if (g_Game && g_Game->GetTurnManager()) | if (CGame::isGameInitialised() && CGame::getGame()->GetTurnManager()) | ||||
g_Game->GetTurnManager()->PostCommand(cmd); | CGame::getGame()->GetTurnManager()->PostCommand(cmd); | ||||
} | } | ||||
virtual void FlushTurn(const std::vector<SimulationCommand>& commands) | virtual void FlushTurn(const std::vector<SimulationCommand>& commands) | ||||
{ | { | ||||
const ScriptInterface& scriptInterface = GetSimContext().GetScriptInterface(); | const ScriptInterface& scriptInterface = GetSimContext().GetScriptInterface(); | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
Show All 21 Lines |
Wildfire Games · Phabricator