From 2f43cbafa0da1266ab55e39b94a88af65c844ea0 Mon Sep 17 00:00:00 2001 From: whiterandrek Date: Fri, 27 Apr 2018 08:36:43 +0300 Subject: PINK: moved more values to constants section --- engines/pink/constants.h | 6 +++++- engines/pink/objects/module.cpp | 2 +- engines/pink/objects/pages/game_page.cpp | 2 +- engines/pink/pink.cpp | 14 +++++++------- 4 files changed, 14 insertions(+), 10 deletions(-) (limited to 'engines/pink') diff --git a/engines/pink/constants.h b/engines/pink/constants.h index da572d1f91..6d2b02a9a2 100644 --- a/engines/pink/constants.h +++ b/engines/pink/constants.h @@ -138,8 +138,12 @@ enum { kBroMinorVersion = 0, }; +static const char *kPinkGame = "PinkGame"; -const char *kPinkGame = "PinkGame"; +static const char *kPokus = "pokus"; +static const char *kPeril = "peril"; + +static const char *kUndefined = "UNDEFINED"; } // End of namespace Pink diff --git a/engines/pink/objects/module.cpp b/engines/pink/objects/module.cpp index d35f794540..46ea8e11e4 100644 --- a/engines/pink/objects/module.cpp +++ b/engines/pink/objects/module.cpp @@ -88,7 +88,7 @@ PinkEngine *Module::getGame() const { bool Module::checkValueOfVariable(Common::String &variable, Common::String &value) { if (!_variables.contains(variable)) - return value == "UNDEFINED"; + return value == kUndefined; return _variables[variable] == value; } diff --git a/engines/pink/objects/pages/game_page.cpp b/engines/pink/objects/pages/game_page.cpp index e38bed8da8..6b029fbae3 100644 --- a/engines/pink/objects/pages/game_page.cpp +++ b/engines/pink/objects/pages/game_page.cpp @@ -133,7 +133,7 @@ Module *GamePage::getModule() const { bool GamePage::checkValueOfVariable(Common::String &variable, Common::String &value) { if (!_variables.contains(variable)) - return value == "UNDEFINED"; + return value == kUndefined; return _variables[variable] == value; } diff --git a/engines/pink/pink.cpp b/engines/pink/pink.cpp index 008f8277d9..df23a48110 100644 --- a/engines/pink/pink.cpp +++ b/engines/pink/pink.cpp @@ -68,10 +68,10 @@ Common::Error PinkEngine::init() { _console = new Console(this); - Common::String orbName{_desc.filesDescriptions[0].fileName}; - Common::String broName{_desc.filesDescriptions[1].fileName}; + const Common::String orbName{_desc.filesDescriptions[0].fileName}; + const Common::String broName{_desc.filesDescriptions[1].fileName}; - if (strcmp(_desc.gameId, "peril") == 0){ + if (strcmp(_desc.gameId, kPeril) == 0){ _bro = new BroFile(); } else debug("This game doesn't need to use bro"); @@ -87,8 +87,8 @@ Common::Error PinkEngine::init() { _system->showMouse(1); _orb.loadGame(this); - const Common::String empty; - initModule(_modules[0]->getName(), kLoadingNewGame, empty); + + initModule(_modules[0]->getName(), kLoadingNewGame, ""); return Common::kNoError; } @@ -193,7 +193,7 @@ void PinkEngine::loadModule(int index) { bool PinkEngine::checkValueOfVariable(Common::String &variable, Common::String &value) { if (!_variables.contains(variable)) - return value == "UNDEFINED"; + return value == kUndefined; return _variables[variable] == value; } @@ -203,7 +203,7 @@ void PinkEngine::setVariable(Common::String &variable, Common::String &value) { bool PinkEngine::loadCursors() { Common::PEResources exeResources; - bool isPokus = !strcmp(_desc.gameId, "pokus"); + bool isPokus = !strcmp(_desc.gameId, kPokus); Common::String fileName = isPokus ? _desc.filesDescriptions[1].fileName : _desc.filesDescriptions[2].fileName; if (!exeResources.loadFromEXE(fileName)) return false; -- cgit v1.2.3