Exemplo n.º 1
0
void CNetReplayTurnManager::NotifyFinishedUpdate(u32 turn)
{
	if (turn == 1 && m_FinalTurn == 0)
		g_GUI->SendEventToAll("ReplayFinished");

	if (turn > m_FinalTurn)
		return;

	DoTurn(turn);

	// Compare hash if it exists in the replay and if we didn't have an OOS already
	if (m_HasSyncError || m_ReplayHash.find(turn) == m_ReplayHash.end())
		return;

	std::string expectedHash = m_ReplayHash[turn].first;
	bool quickHash = m_ReplayHash[turn].second;

	// Compute hash
	std::string hash;
	ENSURE(m_Simulation2.ComputeStateHash(hash, quickHash));
	hash = Hexify(hash);

	if (hash != expectedHash)
		DisplayOOSError(turn, hash, expectedHash, true);
}
Exemplo n.º 2
0
void CNetTurnManager::OnSyncError(u32 turn, const CStr& expectedHash, std::vector<CSyncErrorMessage::S_m_PlayerNames>& playerNames)
{
	NETTURN_LOG((L"OnSyncError(%d, %hs)\n", turn, Hexify(expectedHash).c_str()));

	// Only complain the first time
	if (m_HasSyncError)
		return;

	bool quick = !TurnNeedsFullHash(turn);
	std::string hash;
	ENSURE(m_Simulation2.ComputeStateHash(hash, quick));

	OsPath path = psLogDir()/"oos_dump.txt";
	std::ofstream file (OsString(path).c_str(), std::ofstream::out | std::ofstream::trunc);
	m_Simulation2.DumpDebugState(file);
	file.close();

	hash = Hexify(hash);
	const std::string& expectedHashHex = Hexify(expectedHash);

	DisplayOOSError(turn, hash, expectedHashHex, false, &playerNames, &path);
}
Exemplo n.º 3
0
void CNetReplayTurnManager::NotifyFinishedUpdate(u32 turn)
{
	if (turn > m_FinalReplayTurn)
		return;

	debug_printf("Executing turn %d of %d\n", turn, m_FinalReplayTurn);
	DoTurn(turn);

	// Compare hash if it exists in the replay and if we didn't have an OOS already
	if (m_HasSyncError || m_ReplayHash.find(turn) == m_ReplayHash.end())
		return;

	std::string expectedHash = m_ReplayHash[turn].first;
	bool quickHash = m_ReplayHash[turn].second;

	// Compute hash
	std::string hash;
	ENSURE(m_Simulation2.ComputeStateHash(hash, quickHash));
	hash = Hexify(hash);

	if (hash != expectedHash)
		DisplayOOSError(turn, hash, expectedHash, true);
}