1
0
forked from 0ad/0ad

Disable unnecessary state hash check in single-player games.

This was SVN commit r7768.
This commit is contained in:
Ykkrosh 2010-07-19 22:57:04 +00:00
parent 544afca570
commit ac9412458a
2 changed files with 14 additions and 13 deletions

View File

@ -100,13 +100,7 @@ bool CNetTurnManager::Update(float frameLength)
m_Simulation2.Update(TURN_LENGTH, commands);
{
PROFILE("state hash check");
std::string hash;
bool ok = m_Simulation2.ComputeStateHash(hash);
debug_assert(ok);
NotifyFinishedUpdate(m_CurrentTurn, hash);
}
NotifyFinishedUpdate(m_CurrentTurn);
// Set the time for the next turn update
m_DeltaTime -= TURN_LENGTH / 1000.f;
@ -218,12 +212,19 @@ void CNetClientTurnManager::NotifyFinishedOwnCommands(u32 turn)
m_NetClient.SendMessage(&msg);
}
void CNetClientTurnManager::NotifyFinishedUpdate(u32 turn, const std::string& hash)
void CNetClientTurnManager::NotifyFinishedUpdate(u32 turn)
{
#ifdef NETTURN_LOG
NETTURN_LOG(L"NotifyFinishedUpdate(%d, %hs)\n", turn, Hexify(hash).c_str());
#endif
std::string hash;
{
PROFILE("state hash check");
bool ok = m_Simulation2.ComputeStateHash(hash);
debug_assert(ok);
}
// Send message to the server
CSyncCheckMessage msg;
msg.m_Turn = turn;
@ -251,7 +252,7 @@ void CNetLocalTurnManager::NotifyFinishedOwnCommands(u32 turn)
FinishedAllCommands(turn);
}
void CNetLocalTurnManager::NotifyFinishedUpdate(u32 UNUSED(turn), const std::string& UNUSED(hash))
void CNetLocalTurnManager::NotifyFinishedUpdate(u32 UNUSED(turn))
{
}

View File

@ -110,9 +110,9 @@ protected:
virtual void NotifyFinishedOwnCommands(u32 turn) = 0;
/**
* Called when this client has finished a simulation update, with the current state hash.
* Called when this client has finished a simulation update.
*/
virtual void NotifyFinishedUpdate(u32 turn, const std::string& hash) = 0;
virtual void NotifyFinishedUpdate(u32 turn) = 0;
CSimulation2& m_Simulation2;
@ -152,7 +152,7 @@ public:
protected:
virtual void NotifyFinishedOwnCommands(u32 turn);
virtual void NotifyFinishedUpdate(u32 turn, const std::string& hash);
virtual void NotifyFinishedUpdate(u32 turn);
CNetClient& m_NetClient;
};
@ -175,7 +175,7 @@ public:
protected:
virtual void NotifyFinishedOwnCommands(u32 turn);
virtual void NotifyFinishedUpdate(u32 turn, const std::string& hash);
virtual void NotifyFinishedUpdate(u32 turn);
};