Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/NetClient.cpp
Show First 20 Lines • Show All 263 Lines • ▼ Show 20 Lines | 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; | ||||
} | } | ||||
ScriptInterface& CNetClient::GetScriptInterface() | const ScriptInterface& CNetClient::GetScriptInterface() | ||||
{ | { | ||||
return m_Game->GetSimulation2()->GetScriptInterface(); | return m_Game->GetSimulation2()->GetScriptInterface(); | ||||
} | } | ||||
void CNetClient::PostPlayerAssignmentsToScript() | void CNetClient::PostPlayerAssignmentsToScript() | ||||
{ | { | ||||
JSContext* cx = GetScriptInterface().GetContext(); | JSContext* cx = GetScriptInterface().GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | void CNetClient::HandleDisconnect(u32 reason) | ||||
SAFE_DELETE(m_Session); | SAFE_DELETE(m_Session); | ||||
// Update the state immediately to UNCONNECTED (don't bother with FSM transitions since | // Update the state immediately to UNCONNECTED (don't bother with FSM transitions since | ||||
// we'd need one for every single state, and we don't need to use per-state actions) | // we'd need one for every single state, and we don't need to use per-state actions) | ||||
SetCurrState(NCS_UNCONNECTED); | SetCurrState(NCS_UNCONNECTED); | ||||
} | } | ||||
void CNetClient::SendGameSetupMessage(JS::MutableHandleValue attrs, ScriptInterface& scriptInterface) | void CNetClient::SendGameSetupMessage(JS::MutableHandleValue attrs, const ScriptInterface& scriptInterface) | ||||
{ | { | ||||
CGameSetupMessage gameSetup(scriptInterface); | CGameSetupMessage gameSetup(scriptInterface); | ||||
gameSetup.m_Data = attrs; | gameSetup.m_Data = attrs; | ||||
SendMessage(&gameSetup); | SendMessage(&gameSetup); | ||||
} | } | ||||
void CNetClient::SendAssignPlayerMessage(const int playerID, const CStr& guid) | void CNetClient::SendAssignPlayerMessage(const int playerID, const CStr& guid) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 537 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator