mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-25 03:54:41 +00:00
Implement NetClient PushGuiMessage using parameter pack and ScriptInterface::CreateObject from D2080 / b4626359f5 to replace remaining Eval function calls.
Specialize ToJSVal<char[n]> to allow passing string literals as arguments. Freeze NetClient GUI messages. Supersede related c-style casts with static casts. Remove few unneeded conversions. Differential Revision: https://code.wildfiregames.com/D2267 Tested: clang 8.0.1, Jenkins This was SVN commit r22867.
This commit is contained in:
@@ -142,21 +142,12 @@ void CNetClientTurnManager::OnSyncError(u32 turn, const CStr& expectedHash, cons
|
||||
|
||||
LOGERROR("Out-Of-Sync on turn %d\nPlayers: %s\nDumping state to %s", turn, playerNamesString.str().c_str(), oosdumpPath.string8());
|
||||
|
||||
const ScriptInterface& scriptInterface = m_NetClient.GetScriptInterface();
|
||||
JSContext* cx = scriptInterface.GetContext();
|
||||
JSAutoRequest rq(cx);
|
||||
|
||||
JS::RootedValue msg(cx);
|
||||
|
||||
scriptInterface.CreateObject(
|
||||
&msg,
|
||||
"type", std::wstring(L"out-of-sync"),
|
||||
m_NetClient.PushGuiMessage(
|
||||
"type", "out-of-sync",
|
||||
"turn", turn,
|
||||
"players", playerNamesStrings,
|
||||
"expectedHash", expectedHashHex,
|
||||
"hash", Hexify(hash),
|
||||
"path_oos_dump", wstring_from_utf8(oosdumpPath.string8()),
|
||||
"path_replay", wstring_from_utf8(m_Replay.GetDirectory().string8()));
|
||||
|
||||
m_NetClient.PushGuiMessage(msg);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user