Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/network/NetClientTurnManager.cpp
/* Copyright (C) 2018 Wildfire Games. | /* Copyright (C) 2019 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
▲ Show 20 Lines • Show All 132 Lines • ▼ Show 20 Lines | void CNetClientTurnManager::OnSyncError(u32 turn, const CStr& expectedHash, const std::vector<CSyncErrorMessage::S_m_PlayerNames>& playerNames) | ||||
LOGERROR("Out-Of-Sync on turn %d\nPlayers: %s\nDumping state to %s", turn, playerNamesString.str().c_str(), oosdumpPath.string8()); | 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(); | const ScriptInterface& scriptInterface = m_NetClient.GetScriptInterface(); | ||||
JSContext* cx = scriptInterface.GetContext(); | JSContext* cx = scriptInterface.GetContext(); | ||||
JSAutoRequest rq(cx); | JSAutoRequest rq(cx); | ||||
JS::RootedValue msg(cx); | JS::RootedValue msg(cx); | ||||
scriptInterface.Eval("({ 'type':'out-of-sync' })", &msg); | |||||
scriptInterface.SetProperty(msg, "turn", turn); | scriptInterface.CreateObject( | ||||
scriptInterface.SetProperty(msg, "players", playerNamesStrings); | &msg, | ||||
scriptInterface.SetProperty(msg, "expectedHash", expectedHashHex); | "type", std::wstring(L"out-of-sync"), | ||||
scriptInterface.SetProperty(msg, "hash", Hexify(hash)); | "turn", turn, | ||||
scriptInterface.SetProperty(msg, "path_oos_dump", wstring_from_utf8(oosdumpPath.string8())); | "players", playerNamesStrings, | ||||
scriptInterface.SetProperty(msg, "path_replay", wstring_from_utf8(m_Replay.GetDirectory().string8())); | "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); | m_NetClient.PushGuiMessage(msg); | ||||
} | } |
Wildfire Games · Phabricator