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:
elexis
2019-09-07 16:51:44 +00:00
parent f29159b935
commit 508da732af
8 changed files with 209 additions and 207 deletions
+2 -11
View File
@@ -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);
}