1
0
forked from mirrors/0ad

Return the value from GuiPoll

This commit is contained in:
phosit
2024-11-11 21:54:58 +01:00
parent f23dde2f73
commit cfb742c914
3 changed files with 8 additions and 15 deletions
+6 -8
View File
@@ -357,16 +357,15 @@ void CNetClient::CheckServerConnection()
}
}
void CNetClient::GuiPoll(const ScriptRequest& rq, JS::MutableHandleValue ret)
JS::Value CNetClient::GuiPoll(const ScriptRequest& rq)
{
if (m_GuiMessageQueue.empty())
{
ret.setUndefined();
return;
}
return JS::UndefinedValue();
Script::ReadStructuredClone(rq, m_GuiMessageQueue.front(), ret);
JS::RootedValue ret{rq.cx};
Script::ReadStructuredClone(rq, m_GuiMessageQueue.front(), &ret);
m_GuiMessageQueue.pop_front();
return ret;
}
std::string CNetClient::TestReadGuiMessages()
@@ -374,10 +373,9 @@ std::string CNetClient::TestReadGuiMessages()
ScriptRequest rq(GetScriptInterface());
std::string r;
JS::RootedValue msg(rq.cx);
while (true)
{
GuiPoll(rq, &msg);
JS::RootedValue msg{rq.cx, GuiPoll(rq)};
if (msg.isUndefined())
break;
r += Script::ToString(rq, &msg) + "\n";