In non network games the game is paused automatically if a menu/message is raised. I am not sure if I should do this for scenario messages too?

This commit is contained in:
Titus Tscharntke 2012-04-01 18:23:26 +00:00
parent 3d386936dc
commit 874b1a5049
2 changed files with 21 additions and 4 deletions

View File

@ -1849,7 +1849,7 @@ void Game::mouseDownLeft(int x, int y) {
}
if(allowAdminMenuItems) {
if(paused == false) {
if(getPaused() == false) {
commander.tryPauseGame();
}
else {
@ -2460,7 +2460,7 @@ void Game::keyDown(SDL_KeyboardEvent key) {
}
if(allowAdminMenuItems) {
if(paused == false) {
if(getPaused() == false) {
commander.tryPauseGame();
}
else {
@ -3438,12 +3438,29 @@ void Game::setPaused(bool value,bool forceAllowPauseStateChange) {
}
}
bool Game::getPaused()
{
bool speedChangesAllowed= !NetworkManager::getInstance().isNetworkGame();
if(speedChangesAllowed){
if(popupMenu.getVisible() == true || popupMenuSwitchTeams.getVisible() == true){
return true;
}
if(mainMessageBox.getEnabled() == true || errorMessageBox.getEnabled() == true){
return true;
}
if(currentUIState != NULL) {
return true;
}
}
return paused;
}
int Game::getUpdateLoops() {
if(commander.hasReplayCommandListForFrame() == true) {
return 1;
}
if(paused) {
if(getPaused()) {
return 0;
}
else if(speed == sFast) {

View File

@ -177,7 +177,7 @@ public:
Program *getProgram() {return program;}
bool getPaused() const { return paused;}
bool getPaused();
void setPaused(bool value, bool forceAllowPauseStateChange=false);
const int getTotalRenderFps() const {return totalRenderFps;}