mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
- do not continuously throw errors in game
This commit is contained in:
parent
734694655f
commit
ae5018c4dc
@ -1076,6 +1076,10 @@ Command* Commander::buildCommand(const NetworkCommand* networkCommand) const {
|
||||
//throw megaglest_runtime_error("Test missing command type!");
|
||||
|
||||
//validate command type
|
||||
|
||||
// !!!Test out of synch behaviour
|
||||
//ct = NULL;
|
||||
|
||||
if(ct == NULL) {
|
||||
char szBuf[10400]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d]\nCan not find command type for network command = [%s]\n%s\nfor unit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nUnit Type Info:\n[%s]\nNetwork unit type:\n[%s]\nGame out of synch.",
|
||||
|
@ -94,6 +94,7 @@ Game::Game() : ProgramState(NULL) {
|
||||
weatherParticleSystem=NULL;
|
||||
isFirstRender=false;
|
||||
quitTriggeredIndicator=false;
|
||||
quitPendingIndicator=false;
|
||||
original_updateFps=0;
|
||||
original_cameraFps=0;
|
||||
captureAvgTestStatus=false;
|
||||
@ -176,6 +177,7 @@ void Game::resetMembers() {
|
||||
|
||||
mouseMoved= false;
|
||||
quitTriggeredIndicator = false;
|
||||
quitPendingIndicator=false;
|
||||
originalDisplayMsgCallback = NULL;
|
||||
thisGamePtr = this;
|
||||
|
||||
@ -1362,11 +1364,19 @@ void Game::update() {
|
||||
|
||||
// a) Updates non dependent on speed
|
||||
|
||||
if(NetworkManager::getInstance().getGameNetworkInterface() != NULL &&
|
||||
NetworkManager::getInstance().getGameNetworkInterface()->getQuit() &&
|
||||
mainMessageBox.getEnabled() == false &&
|
||||
errorMessageBox.getEnabled() == false) {
|
||||
bool pendingQuitError = (quitPendingIndicator == true ||
|
||||
(NetworkManager::getInstance().getGameNetworkInterface() != NULL &&
|
||||
NetworkManager::getInstance().getGameNetworkInterface()->getQuit()));
|
||||
|
||||
//if(pendingQuitError) printf("#1 pendingQuitError = %d, quitPendingIndicator = %d, errorMessageBox.getEnabled() = %d\n",pendingQuitError,quitPendingIndicator,errorMessageBox.getEnabled());
|
||||
|
||||
if(pendingQuitError == true &&
|
||||
(this->masterserverMode == true ||
|
||||
(mainMessageBox.getEnabled() == false && errorMessageBox.getEnabled() == false))) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
|
||||
|
||||
//printf("#2 pendingQuitError = %d, quitPendingIndicator = %d, errorMessageBox.getEnabled() = %d\n",pendingQuitError,quitPendingIndicator,errorMessageBox.getEnabled());
|
||||
|
||||
quitTriggeredIndicator = true;
|
||||
return;
|
||||
}
|
||||
@ -1447,7 +1457,7 @@ void Game::update() {
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] [i = %d] faction = %d, factionCount = %d, took msecs: %lld [before AI updates]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,j,world.getFactionCount(),chrono.getMillis());
|
||||
|
||||
aiInterfaces[j]->update();
|
||||
if(pendingQuitError == false) aiInterfaces[j]->update();
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] [i = %d] faction = %d, factionCount = %d, took msecs: %lld [after AI updates]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,i,j,world.getFactionCount(),chrono.getMillis());
|
||||
}
|
||||
@ -1500,7 +1510,7 @@ void Game::update() {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
|
||||
|
||||
//World
|
||||
world.update();
|
||||
if(pendingQuitError == false) world.update();
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld [world update i = %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),i);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
|
||||
|
||||
@ -1532,7 +1542,7 @@ void Game::update() {
|
||||
|
||||
// Commander
|
||||
//commander.updateNetwork();
|
||||
commander.signalNetworkUpdate(this);
|
||||
if(pendingQuitError == false) commander.signalNetworkUpdate(this);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld [commander updateNetwork i = %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),i);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
|
||||
@ -1562,7 +1572,7 @@ void Game::update() {
|
||||
}
|
||||
//else if(role == nrClient) {
|
||||
else {
|
||||
commander.signalNetworkUpdate(this);
|
||||
if(pendingQuitError == false) commander.signalNetworkUpdate(this);
|
||||
|
||||
if(playingStaticVideo == true) {
|
||||
if(videoPlayer->isPlaying() == false) {
|
||||
@ -1743,12 +1753,16 @@ void Game::update() {
|
||||
}
|
||||
}
|
||||
catch(const exception &ex) {
|
||||
quitPendingIndicator = true;
|
||||
|
||||
char szBuf[4096]="";
|
||||
sprintf(szBuf,"In [%s::%s Line: %d] Error [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,ex.what());
|
||||
|
||||
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
|
||||
|
||||
//printf("#100 quitPendingIndicator = %d, errorMessageBox.getEnabled() = %d\n",quitPendingIndicator,errorMessageBox.getEnabled());
|
||||
|
||||
NetworkManager &networkManager= NetworkManager::getInstance();
|
||||
if(networkManager.getGameNetworkInterface() != NULL) {
|
||||
GameNetworkInterface *networkInterface = NetworkManager::getInstance().getGameNetworkInterface();
|
||||
|
@ -118,6 +118,7 @@ private:
|
||||
bool isFirstRender;
|
||||
|
||||
bool quitTriggeredIndicator;
|
||||
bool quitPendingIndicator;
|
||||
|
||||
int original_updateFps;
|
||||
int original_cameraFps;
|
||||
|
@ -271,7 +271,14 @@ void ClientInterface::updateLobby() {
|
||||
|
||||
//send intro message
|
||||
Lang &lang= Lang::getInstance();
|
||||
NetworkMessageIntro sendNetworkMessageIntro(sessionKey,getNetworkVersionSVNString(), getHumanPlayerName(), -1, nmgstOk, this->getSocket()->getConnectedIPAddress(),serverFTPPort,lang.getLanguage());
|
||||
NetworkMessageIntro sendNetworkMessageIntro(
|
||||
sessionKey,getNetworkVersionSVNString(),
|
||||
getHumanPlayerName(),
|
||||
-1,
|
||||
nmgstOk,
|
||||
this->getSocket()->getConnectedIPAddress(),
|
||||
serverFTPPort,
|
||||
lang.getLanguage());
|
||||
sendMessage(&sendNetworkMessageIntro);
|
||||
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
@ -465,8 +465,16 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] !!!!!!!!WARNING - no open slots, disconnecting client\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(this->getSocket() != NULL) {
|
||||
NetworkMessageIntro networkMessageIntro(sessionKey,getNetworkVersionSVNString(), getHostName(), playerIndex, nmgstNoSlots, 0, ServerSocket::getFTPServerPort(),"");
|
||||
sendMessage(&networkMessageIntro);
|
||||
NetworkMessageIntro networkMessageIntro(
|
||||
sessionKey,
|
||||
getNetworkVersionSVNString(),
|
||||
getHostName(),
|
||||
playerIndex,
|
||||
nmgstNoSlots,
|
||||
0,
|
||||
ServerSocket::getFTPServerPort(),
|
||||
"");
|
||||
sendMessage(&networkMessageIntro);
|
||||
//}
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
@ -477,8 +485,16 @@ void ConnectionSlot::update(bool checkForNewClients,int lockedSlotIndex) {
|
||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] client will be assigned to the next open slot\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
//if(this->getSocket() != NULL) {
|
||||
NetworkMessageIntro networkMessageIntro(sessionKey,getNetworkVersionSVNString(), getHostName(), playerIndex, nmgstOk, 0, ServerSocket::getFTPServerPort(),"");
|
||||
sendMessage(&networkMessageIntro);
|
||||
NetworkMessageIntro networkMessageIntro(
|
||||
sessionKey,
|
||||
getNetworkVersionSVNString(),
|
||||
getHostName(),
|
||||
playerIndex,
|
||||
nmgstOk,
|
||||
0,
|
||||
ServerSocket::getFTPServerPort(),
|
||||
"");
|
||||
sendMessage(&networkMessageIntro);
|
||||
|
||||
//if(chrono.getMillis() > 1) printf("In [%s::%s Line: %d] action running for msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,(long long int)chrono.getMillis());
|
||||
//}
|
||||
|
Loading…
x
Reference in New Issue
Block a user