- 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__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
|
quitTriggeredIndicator = false;
|
||||||
originalDisplayMsgCallback = NULL;
|
originalDisplayMsgCallback = NULL;
|
||||||
thisGamePtr = this;
|
thisGamePtr = this;
|
||||||
|
|
||||||
|
@ -113,6 +114,14 @@ Game::~Game(){
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
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 ====================
|
// ==================== init and load ====================
|
||||||
|
|
||||||
int Game::ErrorDisplayMessage(const char *msg, bool exitApp) {
|
int Game::ErrorDisplayMessage(const char *msg, bool exitApp) {
|
||||||
|
@ -554,7 +563,8 @@ void Game::update(){
|
||||||
mainMessageBox.getEnabled() == false &&
|
mainMessageBox.getEnabled() == false &&
|
||||||
errorMessageBox.getEnabled() == false) {
|
errorMessageBox.getEnabled() == false) {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
quitGame();
|
//quitGame();
|
||||||
|
quitTriggeredIndicator = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -726,7 +736,8 @@ void Game::mouseDownLeft(int x, int y){
|
||||||
if(networkManager.getGameNetworkInterface() != NULL) {
|
if(networkManager.getGameNetworkInterface() != NULL) {
|
||||||
networkManager.getGameNetworkInterface()->quitGame(true);
|
networkManager.getGameNetworkInterface()->quitGame(true);
|
||||||
}
|
}
|
||||||
quitGame();
|
//quitGame();
|
||||||
|
quitTriggeredIndicator = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -86,6 +86,8 @@ private:
|
||||||
DisplayMessageFunction originalDisplayMsgCallback;
|
DisplayMessageFunction originalDisplayMsgCallback;
|
||||||
bool isFirstRender;
|
bool isFirstRender;
|
||||||
|
|
||||||
|
bool quitTriggeredIndicator;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Game(Program *program, const GameSettings *gameSettings);
|
Game(Program *program, const GameSettings *gameSettings);
|
||||||
~Game();
|
~Game();
|
||||||
|
@ -123,9 +125,12 @@ public:
|
||||||
virtual void eventMouseWheel(int x, int y, int zDelta);
|
virtual void eventMouseWheel(int x, int y, int zDelta);
|
||||||
virtual void mouseMove(int x, int y, const MouseState *mouseState);
|
virtual void mouseMove(int x, int y, const MouseState *mouseState);
|
||||||
|
|
||||||
void quitGame();
|
|
||||||
virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); }
|
virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); }
|
||||||
|
|
||||||
|
virtual bool quitTriggered();
|
||||||
|
virtual void quitAndToggleState();
|
||||||
|
void quitGame();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//render
|
//render
|
||||||
void render3d();
|
void render3d();
|
||||||
|
|
|
@ -231,6 +231,10 @@ void Program::loopWorker() {
|
||||||
//render
|
//render
|
||||||
assert(programState != NULL);
|
assert(programState != NULL);
|
||||||
|
|
||||||
|
if(this->programState->quitTriggered() == true) {
|
||||||
|
this->programState->quitAndToggleState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
ProgramState *prevState = this->programState;
|
ProgramState *prevState = this->programState;
|
||||||
|
|
||||||
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
//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 setStartXY(int X,int Y) { startX=X; startY=Y; }
|
||||||
virtual void restoreToStartXY() { SDL_WarpMouse(startX, startY); }
|
virtual void restoreToStartXY() { SDL_WarpMouse(startX, startY); }
|
||||||
virtual bool isInSpecialKeyCaptureEvent() { return false; }
|
virtual bool isInSpecialKeyCaptureEvent() { return false; }
|
||||||
|
virtual bool quitTriggered() { return false; }
|
||||||
|
virtual void quitAndToggleState() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
// ===============================
|
// ===============================
|
||||||
|
|
Loading…
Reference in New Issue
Block a user