allow game to be paused before player joins game and retain pause state
This commit is contained in:
parent
173075d962
commit
4ca6c232cf
|
@ -84,6 +84,7 @@ Game::Game() : ProgramState(NULL) {
|
||||||
currentAvgRenderFpsTotal=0;
|
currentAvgRenderFpsTotal=0;
|
||||||
paused=false;
|
paused=false;
|
||||||
pausedForJoinGame=false;
|
pausedForJoinGame=false;
|
||||||
|
pausedBeforeJoinGame=false;
|
||||||
pauseRequestSent=false;
|
pauseRequestSent=false;
|
||||||
resumeRequestSent=false;
|
resumeRequestSent=false;
|
||||||
pauseStateChanged=false;
|
pauseStateChanged=false;
|
||||||
|
@ -250,6 +251,7 @@ void Game::resetMembers() {
|
||||||
tickCount=0;
|
tickCount=0;
|
||||||
paused= false;
|
paused= false;
|
||||||
pausedForJoinGame=false;
|
pausedForJoinGame=false;
|
||||||
|
pausedBeforeJoinGame=false;
|
||||||
resumeRequestSent=false;
|
resumeRequestSent=false;
|
||||||
pauseRequestSent=false;
|
pauseRequestSent=false;
|
||||||
pauseStateChanged=false;
|
pauseStateChanged=false;
|
||||||
|
@ -2363,8 +2365,10 @@ void Game::update() {
|
||||||
//printf("Resuming game for join in progress game resumeRequestSent: %d...\n",resumeRequestSent);
|
//printf("Resuming game for join in progress game resumeRequestSent: %d...\n",resumeRequestSent);
|
||||||
|
|
||||||
//commander.tryResumeGame(true,false);
|
//commander.tryResumeGame(true,false);
|
||||||
commander.tryResumeGame(true,true);
|
if(pausedBeforeJoinGame == false && resumeRequestSent == false) {
|
||||||
resumeRequestSent = true;
|
commander.tryResumeGame(true,true);
|
||||||
|
resumeRequestSent = true;
|
||||||
|
}
|
||||||
|
|
||||||
// server->setAllowInGameConnections(false);
|
// server->setAllowInGameConnections(false);
|
||||||
// for(int i = 0; i < world.getFactionCount(); ++i) {
|
// for(int i = 0; i < world.getFactionCount(); ++i) {
|
||||||
|
@ -5714,6 +5718,7 @@ void Game::setPaused(bool value,bool forceAllowPauseStateChange,bool clearCaches
|
||||||
console.addLine(lang.get("GameResumed"));
|
console.addLine(lang.get("GameResumed"));
|
||||||
paused= false;
|
paused= false;
|
||||||
pausedForJoinGame = false;
|
pausedForJoinGame = false;
|
||||||
|
pausedBeforeJoinGame = false;
|
||||||
pauseStateChanged = true;
|
pauseStateChanged = true;
|
||||||
|
|
||||||
if(clearCaches == true) {
|
if(clearCaches == true) {
|
||||||
|
@ -5742,6 +5747,10 @@ void Game::setPaused(bool value,bool forceAllowPauseStateChange,bool clearCaches
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.addLine(lang.get("GamePaused"));
|
console.addLine(lang.get("GamePaused"));
|
||||||
|
|
||||||
|
if(joinNetworkGame == true) {
|
||||||
|
pausedBeforeJoinGame = paused;
|
||||||
|
}
|
||||||
paused= true;
|
paused= true;
|
||||||
pausedForJoinGame = joinNetworkGame;
|
pausedForJoinGame = joinNetworkGame;
|
||||||
pauseStateChanged = true;
|
pauseStateChanged = true;
|
||||||
|
|
|
@ -98,6 +98,7 @@ private:
|
||||||
bool resumeRequestSent;
|
bool resumeRequestSent;
|
||||||
bool pauseStateChanged;
|
bool pauseStateChanged;
|
||||||
bool pausedForJoinGame;
|
bool pausedForJoinGame;
|
||||||
|
bool pausedBeforeJoinGame;
|
||||||
|
|
||||||
bool gameOver;
|
bool gameOver;
|
||||||
bool renderNetworkStatus;
|
bool renderNetworkStatus;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user