Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetClient.cpp
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | void CNetClient::GuiPoll(JS::MutableHandleValue ret) | ||||
} | } | ||||
ret.set(m_GuiMessageQueue.front()); | ret.set(m_GuiMessageQueue.front()); | ||||
m_GuiMessageQueue.pop_front(); | m_GuiMessageQueue.pop_front(); | ||||
} | } | ||||
std::string CNetClient::TestReadGuiMessages() | std::string CNetClient::TestReadGuiMessages() | ||||
{ | { | ||||
ScriptInterface::Request rq(GetScriptInterface()); | ScriptRequest rq(GetScriptInterface()); | ||||
std::string r; | std::string r; | ||||
JS::RootedValue msg(rq.cx); | JS::RootedValue msg(rq.cx); | ||||
while (true) | while (true) | ||||
{ | { | ||||
GuiPoll(&msg); | GuiPoll(&msg); | ||||
if (msg.isUndefined()) | if (msg.isUndefined()) | ||||
break; | break; | ||||
r += GetScriptInterface().ToString(&msg) + "\n"; | r += GetScriptInterface().ToString(&msg) + "\n"; | ||||
} | } | ||||
return r; | return r; | ||||
} | } | ||||
const ScriptInterface& CNetClient::GetScriptInterface() | const ScriptInterface& CNetClient::GetScriptInterface() | ||||
{ | { | ||||
return m_Game->GetSimulation2()->GetScriptInterface(); | return m_Game->GetSimulation2()->GetScriptInterface(); | ||||
} | } | ||||
void CNetClient::PostPlayerAssignmentsToScript() | void CNetClient::PostPlayerAssignmentsToScript() | ||||
{ | { | ||||
ScriptInterface::Request rq(GetScriptInterface()); | ScriptRequest rq(GetScriptInterface()); | ||||
JS::RootedValue newAssignments(rq.cx); | JS::RootedValue newAssignments(rq.cx); | ||||
ScriptInterface::CreateObject(rq, &newAssignments); | ScriptInterface::CreateObject(rq, &newAssignments); | ||||
for (const std::pair<CStr, PlayerAssignment>& p : m_PlayerAssignments) | for (const std::pair<CStr, PlayerAssignment>& p : m_PlayerAssignments) | ||||
{ | { | ||||
JS::RootedValue assignment(rq.cx); | JS::RootedValue assignment(rq.cx); | ||||
▲ Show 20 Lines • Show All 578 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator