From c5f41b29fa1a7baf3e5b03e1d37bb2b95ba2b9fe Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Sat, 6 Jun 2009 17:42:37 +0000 Subject: Stop abusing game flag. svn-id: r41247 --- engines/agi/agi.cpp | 2 +- engines/agi/agi.h | 5 +++-- engines/agi/detection.cpp | 4 ++-- engines/agi/saveload.cpp | 4 ++-- engines/agi/text.cpp | 10 +++++----- 5 files changed, 13 insertions(+), 12 deletions(-) (limited to 'engines/agi') diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp index 3b61807dfb..fb753c817f 100644 --- a/engines/agi/agi.cpp +++ b/engines/agi/agi.cpp @@ -626,7 +626,7 @@ AgiButtonStyle::AgiButtonStyle(Common::RenderMode renderMode) { } AgiBase::AgiBase(OSystem *syst, const AGIGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) { - + _noSaveLoadAllowed = false; } AgiEngine::AgiEngine(OSystem *syst, const AGIGameDescription *gameDesc) : AgiBase(syst, gameDesc) { diff --git a/engines/agi/agi.h b/engines/agi/agi.h index fb58c86db2..4144304ca0 100644 --- a/engines/agi/agi.h +++ b/engines/agi/agi.h @@ -331,8 +331,7 @@ enum { fStatusSelectsItems, fMenusWork, fOutputMode, // 15 - fAutoRestart, - fNoSaveLoadAllowed + fAutoRestart }; enum AgiSlowliness { @@ -726,6 +725,8 @@ public: AgiGame _game; Common::RandomSource *_rnd; + bool _noSaveLoadAllowed; + virtual void agiTimerLow() = 0; virtual int agiGetKeypressLow() = 0; virtual int agiIsKeypressLow() = 0; diff --git a/engines/agi/detection.cpp b/engines/agi/detection.cpp index 880f6e4fd6..e1bb686055 100644 --- a/engines/agi/detection.cpp +++ b/engines/agi/detection.cpp @@ -1178,11 +1178,11 @@ Common::Error AgiBase::saveGameState(int slot, const char *desc) { } bool AgiBase::canLoadGameStateCurrently() { - return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !getflag(fNoSaveLoadAllowed) && _game.inputEnabled); + return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !_noSaveLoadAllowed && _game.inputEnabled); } bool AgiBase::canSaveGameStateCurrently() { - return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !getflag(fNoSaveLoadAllowed) && _game.inputEnabled); + return (!(getGameType() == GType_PreAGI) && getflag(fMenusWork) && !_noSaveLoadAllowed && _game.inputEnabled); } } // End of namespace Agi diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index 46f6d8d734..2438601b0c 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -578,7 +578,7 @@ int AgiEngine::selectSlot() { int textCentre, buttonLength, buttonX[2], buttonY; const char *buttonText[] = { " OK ", "Cancel", NULL }; - setflag(fNoSaveLoadAllowed, true); + _noSaveLoadAllowed = true; for (i = 0; i < NUM_VISIBLE_SLOTS; i++) { getSavegameDescription(_firstSlot + i, desc[i]); @@ -763,7 +763,7 @@ press: getout: closeWindow(); - setflag(fNoSaveLoadAllowed, false); + _noSaveLoadAllowed = false; return rc; } diff --git a/engines/agi/text.cpp b/engines/agi/text.cpp index 1383419b24..9db15b6615 100644 --- a/engines/agi/text.cpp +++ b/engines/agi/text.cpp @@ -340,7 +340,7 @@ int AgiEngine::selectionBox(const char *m, const char **b) { int rc = -1; int bx[5], by[5]; - setflag(fNoSaveLoadAllowed, true); + _noSaveLoadAllowed = true; _sprites->eraseBoth(); blitTextbox(m, -1, -1, -1); @@ -426,7 +426,7 @@ getout: closeWindow(); debugC(2, kDebugLevelText, "selectionBox(): Result = %d", rc); - setflag(fNoSaveLoadAllowed, false); + _noSaveLoadAllowed = false; return rc; } @@ -456,7 +456,7 @@ int AgiEngine::print(const char *p, int lin, int col, int len) { // blocking - setflag(fNoSaveLoadAllowed, true); + _noSaveLoadAllowed = true; if (_game.vars[vWindowReset] == 0) { int k; @@ -464,7 +464,7 @@ int AgiEngine::print(const char *p, int lin, int col, int len) { k = waitKey(); closeWindow(); - setflag(fNoSaveLoadAllowed, false); + _noSaveLoadAllowed = false; return k; } @@ -492,7 +492,7 @@ int AgiEngine::print(const char *p, int lin, int col, int len) { closeWindow(); - setflag(fNoSaveLoadAllowed, false); + _noSaveLoadAllowed = false; return 0; } -- cgit v1.2.3