Changeset View
Changeset View
Standalone View
Standalone View
source/network/NetServerTurnManager.cpp
Show All 27 Lines | |||||
#if 0 | #if 0 | ||||
#define NETSERVERTURN_LOG(...) debug_printf(__VA_ARGS__) | #define NETSERVERTURN_LOG(...) debug_printf(__VA_ARGS__) | ||||
#else | #else | ||||
#define NETSERVERTURN_LOG(...) | #define NETSERVERTURN_LOG(...) | ||||
#endif | #endif | ||||
CNetServerTurnManager::CNetServerTurnManager(CNetServerWorker& server) | CNetServerTurnManager::CNetServerTurnManager(CNetServerWorker& server) | ||||
: m_NetServer(server), m_ReadyTurn(1), m_TurnLength(DEFAULT_TURN_LENGTH_MP), m_HasSyncError(false) | : m_NetServer(server), m_ReadyTurn(1), m_TurnLength(DEFAULT_TURN_LENGTH_MP), m_HasSyncError(false) | ||||
{ | { | ||||
// The first turn we will actually execute is number 2, | // Turn 0 is not actually executed, store a dummy value. | ||||
wraitii: I //think// this comment is wrong, and turn 1 is actually executed. | |||||
// so store dummy values into the saved lengths list | |||||
m_SavedTurnLengths.push_back(0); | |||||
m_SavedTurnLengths.push_back(0); | m_SavedTurnLengths.push_back(0); | ||||
wraitiiAuthorUnsubmitted Done Inline ActionsThis is only technically correct in that CheckClientsReady will only ever send a CEndCommandBatchMessage message for turns 2 and above, but turn 1 is executed by all clients, in fact this is what triggers the whole process. wraitii: This is only technically correct in that `CheckClientsReady` will only ever send a… | |||||
// Turn 1 is special: all clients run it without waiting on a server command batch. | |||||
// Because of this, it is always run with the default MP turn length. | |||||
m_SavedTurnLengths.push_back(m_TurnLength); | |||||
} | } | ||||
void CNetServerTurnManager::NotifyFinishedClientCommands(CNetServerSession& session, u32 turn) | void CNetServerTurnManager::NotifyFinishedClientCommands(CNetServerSession& session, u32 turn) | ||||
{ | { | ||||
int client = session.GetHostID(); | int client = session.GetHostID(); | ||||
NETSERVERTURN_LOG("NotifyFinishedClientCommands(client=%d, turn=%d)\n", client, turn); | NETSERVERTURN_LOG("NotifyFinishedClientCommands(client=%d, turn=%d)\n", client, turn); | ||||
▲ Show 20 Lines • Show All 153 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
I think this comment is wrong, and turn 1 is actually executed.