- a better attempt to safely end games and hopefully fix the delete cells bug once for all
This commit is contained in:
parent
c63283ffac
commit
860b00df44
|
@ -45,6 +45,7 @@ Game::Game(Program *program, const GameSettings *gameSettings):
|
|||
{
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
||||
quitTriggeredIndicator = false;
|
||||
originalDisplayMsgCallback = NULL;
|
||||
thisGamePtr = this;
|
||||
|
||||
|
@ -113,6 +114,14 @@ Game::~Game(){
|
|||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
}
|
||||
|
||||
bool Game::quitTriggered() {
|
||||
return quitTriggeredIndicator;
|
||||
}
|
||||
|
||||
void Game::quitAndToggleState() {
|
||||
quitGame();
|
||||
}
|
||||
|
||||
// ==================== init and load ====================
|
||||
|
||||
int Game::ErrorDisplayMessage(const char *msg, bool exitApp) {
|
||||
|
@ -554,7 +563,8 @@ void Game::update(){
|
|||
mainMessageBox.getEnabled() == false &&
|
||||
errorMessageBox.getEnabled() == false) {
|
||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
quitGame();
|
||||
//quitGame();
|
||||
quitTriggeredIndicator = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -726,7 +736,8 @@ void Game::mouseDownLeft(int x, int y){
|
|||
if(networkManager.getGameNetworkInterface() != NULL) {
|
||||
networkManager.getGameNetworkInterface()->quitGame(true);
|
||||
}
|
||||
quitGame();
|
||||
//quitGame();
|
||||
quitTriggeredIndicator = true;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -86,6 +86,8 @@ private:
|
|||
DisplayMessageFunction originalDisplayMsgCallback;
|
||||
bool isFirstRender;
|
||||
|
||||
bool quitTriggeredIndicator;
|
||||
|
||||
public:
|
||||
Game(Program *program, const GameSettings *gameSettings);
|
||||
~Game();
|
||||
|
@ -123,9 +125,12 @@ public:
|
|||
virtual void eventMouseWheel(int x, int y, int zDelta);
|
||||
virtual void mouseMove(int x, int y, const MouseState *mouseState);
|
||||
|
||||
void quitGame();
|
||||
virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); }
|
||||
|
||||
virtual bool quitTriggered();
|
||||
virtual void quitAndToggleState();
|
||||
void quitGame();
|
||||
|
||||
private:
|
||||
//render
|
||||
void render3d();
|
||||
|
|
|
@ -231,6 +231,10 @@ void Program::loopWorker() {
|
|||
//render
|
||||
assert(programState != NULL);
|
||||
|
||||
if(this->programState->quitTriggered() == true) {
|
||||
this->programState->quitAndToggleState();
|
||||
return;
|
||||
}
|
||||
ProgramState *prevState = this->programState;
|
||||
|
||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||
|
|
|
@ -76,6 +76,8 @@ public:
|
|||
virtual void setStartXY(int X,int Y) { startX=X; startY=Y; }
|
||||
virtual void restoreToStartXY() { SDL_WarpMouse(startX, startY); }
|
||||
virtual bool isInSpecialKeyCaptureEvent() { return false; }
|
||||
virtual bool quitTriggered() { return false; }
|
||||
virtual void quitAndToggleState() {};
|
||||
};
|
||||
|
||||
// ===============================
|
||||
|
|
Loading…
Reference in New Issue