- bugfix for network CRC comparison so we don't lose frames
This commit is contained in:
parent
d4a6645a4d
commit
970de758e4
|
@ -1687,6 +1687,33 @@ void Game::setupPopupMenus(bool checkClientAdminOverrideOnly) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::processNetworkSynchChecksIfRequired() {
|
||||||
|
bool isNetworkGame = this->gameSettings.isNetworkGame();
|
||||||
|
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();
|
||||||
|
|
||||||
|
NetworkInterface *netIntf = networkManager.getGameNetworkInterface();
|
||||||
|
for(int index = 0; index < GameConstants::maxPlayers; ++index) {
|
||||||
|
if(index < world.getFactionCount()) {
|
||||||
|
Faction *faction = world.getFaction(index);
|
||||||
|
netIntf->setNetworkPlayerFactionCRC(index,faction->getCRC().getSum());
|
||||||
|
faction->addCRC_DetailsForWorldFrame(world.getFrameCount(),role == nrServer);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
netIntf->setNetworkPlayerFactionCRC(index,0);
|
||||||
|
}
|
||||||
|
|
||||||
|
//if(world.getFrameCount() % 40 == 0) {
|
||||||
|
// printf("Frame #: %d Faction: %d CRC: %u\n",world.getFrameCount(),index,netIntf->getNetworkPlayerFactionCRC(index));
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//update
|
//update
|
||||||
void Game::update() {
|
void Game::update() {
|
||||||
try {
|
try {
|
||||||
|
@ -1705,31 +1732,6 @@ void Game::update() {
|
||||||
perfList.push_back(perfBuf);
|
perfList.push_back(perfBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isNetworkGame = this->gameSettings.isNetworkGame();
|
|
||||||
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();
|
|
||||||
|
|
||||||
NetworkInterface *netIntf = networkManager.getGameNetworkInterface();
|
|
||||||
for(int index = 0; index < GameConstants::maxPlayers; ++index) {
|
|
||||||
if(index < world.getFactionCount()) {
|
|
||||||
Faction *faction = world.getFaction(index);
|
|
||||||
netIntf->setNetworkPlayerFactionCRC(index,faction->getCRC().getSum());
|
|
||||||
faction->addCRC_DetailsForWorldFrame(world.getFrameCount(),role == nrServer);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
netIntf->setNetworkPlayerFactionCRC(index,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//if(world.getFrameCount() % 40 == 0) {
|
|
||||||
// printf("Frame #: %d Faction: %d CRC: %u\n",world.getFrameCount(),index,netIntf->getNetworkPlayerFactionCRC(index));
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Chrono chrono;
|
Chrono chrono;
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start();
|
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
|
// Check to see if we are playing a network game and if any players
|
||||||
// have disconnected?
|
// have disconnected?
|
||||||
|
bool isNetworkGame = this->gameSettings.isNetworkGame();
|
||||||
ReplaceDisconnectedNetworkPlayersWithAI(isNetworkGame, role);
|
ReplaceDisconnectedNetworkPlayersWithAI(isNetworkGame, role);
|
||||||
setupPopupMenus(true);
|
setupPopupMenus(true);
|
||||||
|
|
||||||
|
@ -1975,7 +1978,7 @@ void Game::update() {
|
||||||
|
|
||||||
//AiInterface
|
//AiInterface
|
||||||
if(commander.hasReplayCommandListForFrame() == false) {
|
if(commander.hasReplayCommandListForFrame() == false) {
|
||||||
|
processNetworkSynchChecksIfRequired();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
for(int j = 0; j < world.getFactionCount(); ++j) {
|
for(int j = 0; j < world.getFactionCount(); ++j) {
|
||||||
|
|
|
@ -378,6 +378,7 @@ private:
|
||||||
|
|
||||||
bool switchSetupForSlots(ServerInterface *& serverInterface,
|
bool switchSetupForSlots(ServerInterface *& serverInterface,
|
||||||
int startIndex, int endIndex, bool onlyNetworkUnassigned);
|
int startIndex, int endIndex, bool onlyNetworkUnassigned);
|
||||||
|
void processNetworkSynchChecksIfRequired();
|
||||||
};
|
};
|
||||||
|
|
||||||
}}//end namespace
|
}}//end namespace
|
||||||
|
|
Loading…
Reference in New Issue
Block a user