- bugfix for network CRC comparison so we don't lose frames

This commit is contained in:
Mark Vejvoda 2013-09-19 01:35:08 +00:00
parent d4a6645a4d
commit 970de758e4
2 changed files with 30 additions and 26 deletions

View File

@ -1687,27 +1687,10 @@ void Game::setupPopupMenus(bool checkClientAdminOverrideOnly) {
}
}
//update
void Game::update() {
try {
if(currentUIState != NULL) {
currentUIState->update();
}
bool showPerfStats = Config::getInstance().getBool("ShowPerfStats","false");
Chrono chronoPerf;
char perfBuf[8096]="";
std::vector<string> perfList;
if(showPerfStats) chronoPerf.start();
if(showPerfStats) {
sprintf(perfBuf,"=============== FRAME: %d In [%s::%s] Line: %d took msecs: " MG_I64_SPECIFIER "\n",world.getFrameCount(),extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chronoPerf.getMillis());
perfList.push_back(perfBuf);
}
void Game::processNetworkSynchChecksIfRequired() {
bool isNetworkGame = this->gameSettings.isNetworkGame();
if(isNetworkGame == true && NetworkManager::getInstance().getGameNetworkInterface() != NULL) {
GameSettings *settings = world.getGameSettingsPtr();
if (isNetworkGame
== true&& NetworkManager::getInstance().getGameNetworkInterface() != NULL) {GameSettings *settings = world.getGameSettingsPtr();
if(settings != NULL && (settings->getFlagTypes1() & ft1_network_synch_checks) == ft1_network_synch_checks) {
NetworkManager &networkManager = NetworkManager::getInstance();
NetworkRole role = networkManager.getNetworkRole();
@ -1729,6 +1712,25 @@ void Game::update() {
}
}
}
}
//update
void Game::update() {
try {
if(currentUIState != NULL) {
currentUIState->update();
}
bool showPerfStats = Config::getInstance().getBool("ShowPerfStats","false");
Chrono chronoPerf;
char perfBuf[8096]="";
std::vector<string> perfList;
if(showPerfStats) chronoPerf.start();
if(showPerfStats) {
sprintf(perfBuf,"=============== FRAME: %d In [%s::%s] Line: %d took msecs: " MG_I64_SPECIFIER "\n",world.getFrameCount(),extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chronoPerf.getMillis());
perfList.push_back(perfBuf);
}
Chrono chrono;
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
@ -1940,6 +1942,7 @@ void Game::update() {
// Check to see if we are playing a network game and if any players
// have disconnected?
bool isNetworkGame = this->gameSettings.isNetworkGame();
ReplaceDisconnectedNetworkPlayersWithAI(isNetworkGame, role);
setupPopupMenus(true);
@ -1975,7 +1978,7 @@ void Game::update() {
//AiInterface
if(commander.hasReplayCommandListForFrame() == false) {
processNetworkSynchChecksIfRequired();
/*
for(int j = 0; j < world.getFactionCount(); ++j) {

View File

@ -378,6 +378,7 @@ private:
bool switchSetupForSlots(ServerInterface *& serverInterface,
int startIndex, int endIndex, bool onlyNetworkUnassigned);
void processNetworkSynchChecksIfRequired();
};
}}//end namespace