mirror of
https://github.com/spiffcode/hostile-takeover.git
synced 2026-05-12 10:09:39 -06:00
Fix bug with simulation pause state and backgrounding
This commit is contained in:
parent
b06b3db1d4
commit
31ca038021
@ -2687,9 +2687,4 @@ bool Game::SetVar(const char *pszName, const char *pszValue)
|
||||
return m_dictPvars.Set(pszName, pszValue);
|
||||
}
|
||||
|
||||
void Game::GamePause(bool fpause) {
|
||||
if (!gfMultiplayer)
|
||||
gsim.Pause(fpause);
|
||||
}
|
||||
|
||||
} // namespace wi
|
||||
|
||||
@ -2337,7 +2337,6 @@ public:
|
||||
bool AskObserveGame() secGame;
|
||||
bool CheckDatabaseVersion(const char *pszDir, char *pszPdb,
|
||||
bool fUpwardCompatOK) secGame;
|
||||
void GamePause(bool fpause);
|
||||
|
||||
// ModeMatch helpers
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ SurfaceProperties gprops;
|
||||
SDL_FingerID gtouches[2];
|
||||
wi::Point gaptLast[2];
|
||||
bool gfWasBackgrounded;
|
||||
bool gfSimWasPaused;
|
||||
|
||||
char *gpszUdid;
|
||||
|
||||
@ -402,7 +403,10 @@ bool ProcessSdlEvent(base::Message *pmsg, Event *pevt)
|
||||
gpdisp->SetShouldRender(true);
|
||||
|
||||
// Unpause simulation
|
||||
ggame.GamePause(false);
|
||||
if (!gfSimWasPaused) {
|
||||
gsim.Pause(false);
|
||||
gfSimWasPaused = false;
|
||||
}
|
||||
|
||||
// The client was disconected in SDL_APP_DIDENTERBACKGROUND.
|
||||
// Notify the callbacks about this to present the user with a message.
|
||||
@ -430,7 +434,8 @@ bool ProcessSdlEvent(base::Message *pmsg, Event *pevt)
|
||||
gfWasBackgrounded = true;
|
||||
|
||||
// Pause simulation
|
||||
ggame.GamePause(true);
|
||||
gfSimWasPaused = gsim.IsPaused();
|
||||
gsim.Pause(true);
|
||||
|
||||
// Close the connection to the server. If the user returns to the app,
|
||||
// SDL_APP_DIDENTERFOREGROUND will notify gptra's callbacks.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user