diff options
author | Bastien Bouclet | 2018-06-30 21:49:41 +0200 |
---|---|---|
committer | Bastien Bouclet | 2018-06-30 21:57:18 +0200 |
commit | b40e93e11a77ca5b810ba2e6a6678ef25962f057 (patch) | |
tree | 9c1fbc49873904d9f354f0e026ab57546146101c /engines | |
parent | 0ed412a8abc12b68bf7c4ae3ead383d700ea5a16 (diff) | |
download | scummvm-rg350-b40e93e11a77ca5b810ba2e6a6678ef25962f057.tar.gz scummvm-rg350-b40e93e11a77ca5b810ba2e6a6678ef25962f057.tar.bz2 scummvm-rg350-b40e93e11a77ca5b810ba2e6a6678ef25962f057.zip |
MOHAWK: Push down the include of advancedDetector.h
So the whole engine is not recompiled when making changes to the
detection code.
Diffstat (limited to 'engines')
-rw-r--r-- | engines/mohawk/detection.cpp | 25 | ||||
-rw-r--r-- | engines/mohawk/mohawk.h | 10 | ||||
-rw-r--r-- | engines/mohawk/riven.cpp | 8 | ||||
-rw-r--r-- | engines/mohawk/riven.h | 1 |
4 files changed, 29 insertions, 15 deletions
diff --git a/engines/mohawk/detection.cpp b/engines/mohawk/detection.cpp index c185a63174..98783d703e 100644 --- a/engines/mohawk/detection.cpp +++ b/engines/mohawk/detection.cpp @@ -46,6 +46,14 @@ namespace Mohawk { +struct MohawkGameDescription { + ADGameDescription desc; + + uint8 gameType; + uint32 features; + const char *appName; +}; + const char* MohawkEngine::getGameId() const { return _gameDescription->desc.gameId; } @@ -99,6 +107,23 @@ bool MohawkEngine_Riven::hasFeature(EngineFeature f) const { || (f == kSupportsSavingDuringRuntime); } +Common::String MohawkEngine_Riven::getDatafileLanguageName() const { + const ADGameFileDescription *fileDesc; + for (fileDesc = _gameDescription->desc.filesDescriptions; fileDesc->fileName; fileDesc++) { + if (Common::String(fileDesc->fileName).hasPrefix("a_data_")) { + break; + } + } + + if (!fileDesc->fileName) { + warning("Malformed 25th Anniversary Riven entry"); + + return ""; + } + + return Common::String(&fileDesc->fileName[7], strlen(fileDesc->fileName) - 7 - 4); +} + #endif } // End of Namespace Mohawk diff --git a/engines/mohawk/mohawk.h b/engines/mohawk/mohawk.h index d61512a701..ad4ff7b3f0 100644 --- a/engines/mohawk/mohawk.h +++ b/engines/mohawk/mohawk.h @@ -26,7 +26,6 @@ #include "common/scummsys.h" #include "common/array.h" -#include "engines/advancedDetector.h" #include "engines/engine.h" class OSystem; @@ -66,19 +65,12 @@ enum MohawkGameFeatures { GF_LB_10 = (1 << 4) // very early Living Books 1.0 games }; +struct MohawkGameDescription; class Sound; class PauseDialog; class Archive; class CursorManager; -struct MohawkGameDescription { - ADGameDescription desc; - - uint8 gameType; - uint32 features; - const char *appName; -}; - class MohawkEngine : public ::Engine { protected: Common::Error run() override; diff --git a/engines/mohawk/riven.cpp b/engines/mohawk/riven.cpp index 163785ee72..57d7da3770 100644 --- a/engines/mohawk/riven.cpp +++ b/engines/mohawk/riven.cpp @@ -506,15 +506,11 @@ Common::String MohawkEngine_Riven::getLanguageDatafile(char prefix) const { if (!(getFeatures() & GF_25TH) || getLanguage() == Common::EN_ANY) return ""; - if (!Common::String(_gameDescription->desc.filesDescriptions[1].fileName).hasPrefix("a_data_")) { - warning("Malformed 25th Anniversary Riven entry"); - + Common::String language = getDatafileLanguageName(); + if (language.empty()) { return ""; } - const char *fname = _gameDescription->desc.filesDescriptions[1].fileName; - Common::String language(&fname[7], strlen(fname) - 7 - 4); - return Common::String::format("%c_data_%s.mhk", prefix, language.c_str()); } diff --git a/engines/mohawk/riven.h b/engines/mohawk/riven.h index e2a11622a5..30c6eb39fe 100644 --- a/engines/mohawk/riven.h +++ b/engines/mohawk/riven.h @@ -111,6 +111,7 @@ private: // Datafiles MohawkArchive *_extrasFile; // We need a separate handle for the extra data const char **listExpectedDatafiles() const; + Common::String getDatafileLanguageName() const; Common::String getLanguageDatafile(char prefix) const; bool checkDatafiles(); |