Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/simulation2/components/CCmpCommandQueue.cpp
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | virtual void PostNetworkCommand(JS::HandleValue cmd1) | ||||
// TODO: would be nicer to not use globals | // TODO: would be nicer to not use globals | ||||
if (g_Game && g_Game->GetTurnManager()) | if (g_Game && g_Game->GetTurnManager()) | ||||
g_Game->GetTurnManager()->PostCommand(cmd); | g_Game->GetTurnManager()->PostCommand(cmd); | ||||
} | } | ||||
virtual void FlushTurn(const std::vector<SimulationCommand>& commands) | virtual void FlushTurn(const std::vector<SimulationCommand>& commands) | ||||
{ | { | ||||
ScriptInterface& scriptInterface = GetSimContext().GetScriptInterface(); | const ScriptInterface& scriptInterface = GetSimContext().GetScriptInterface(); | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
JS::RootedValue global(cx, scriptInterface.GetGlobalObject()); | JS::RootedValue global(cx, scriptInterface.GetGlobalObject()); | ||||
std::vector<SimulationCommand> localCommands; | std::vector<SimulationCommand> localCommands; | ||||
m_LocalQueue.swap(localCommands); | m_LocalQueue.swap(localCommands); | ||||
for (size_t i = 0; i < localCommands.size(); ++i) | for (size_t i = 0; i < localCommands.size(); ++i) | ||||
Show All 16 Lines |
Wildfire Games · Phabricator