diff options
author | Paul Gilbert | 2010-01-05 08:24:27 +0000 |
---|---|---|
committer | Paul Gilbert | 2010-01-05 08:24:27 +0000 |
commit | 43f19bc722977d5df1d200ecb9dce750f6b579be (patch) | |
tree | c48963d05dc7e50e4b1d1f2a0e91aac4a3fb0471 | |
parent | c8f991e89b96aa33b221cfc2988f00e811044877 (diff) | |
download | scummvm-rg350-43f19bc722977d5df1d200ecb9dce750f6b579be.tar.gz scummvm-rg350-43f19bc722977d5df1d200ecb9dce750f6b579be.tar.bz2 scummvm-rg350-43f19bc722977d5df1d200ecb9dce750f6b579be.zip |
Added a new LureLanguage enumeration of supported languages, and changed game code to use it
svn-id: r47019
-rw-r--r-- | engines/lure/detection.cpp | 13 | ||||
-rw-r--r-- | engines/lure/disk.cpp | 4 | ||||
-rw-r--r-- | engines/lure/lure.cpp | 6 | ||||
-rw-r--r-- | engines/lure/lure.h | 10 |
4 files changed, 28 insertions, 5 deletions
diff --git a/engines/lure/detection.cpp b/engines/lure/detection.cpp index 870ebf70f3..24338ee9a5 100644 --- a/engines/lure/detection.cpp +++ b/engines/lure/detection.cpp @@ -43,6 +43,19 @@ uint32 LureEngine::getFeatures() const { return _gameDescription->features; } Common::Language LureEngine::getLanguage() const { return _gameDescription->desc.language; } Common::Platform LureEngine::getPlatform() const { return _gameDescription->desc.platform; } +LureLanguage LureEngine::getLureLanguage() const { + switch (_gameDescription->desc.language) { + case IT_ITA: return LANG_IT_ITA; + case FR_FRA: return LANG_FR_FRA; + case DE_DEU: return LANG_DE_DEU; + case ES_ESP: return LANG_ES_ESP; + case EN_ANY: return LANG_EN_ANY; + case UNK_LANG: return LANG_UNKNOWN; + default: + error("Unknown game language"); + } +} + } // End of namespace Lure static const PlainGameDescriptor lureGames[] = { diff --git a/engines/lure/disk.cpp b/engines/lure/disk.cpp index 4c6ebc8962..f1838e3d67 100644 --- a/engines/lure/disk.cpp +++ b/engines/lure/disk.cpp @@ -115,7 +115,7 @@ void Disk::openFile(uint8 fileNum) { error("The file %s is not a valid Lure support file", sFilename); // Scan for the correct language block - Common::Language language = LureEngine::getReference().getLanguage(); + LureLanguage language = LureEngine::getReference().getLureLanguage(); bool foundFlag = false; while (!foundFlag) { @@ -123,7 +123,7 @@ void Disk::openFile(uint8 fileNum) { if ((byte)buffer[0] == 0xff) error("Could not find language data in support file"); - if ((language == (Common::Language)buffer[0]) || (language == UNK_LANG)) { + if ((language == (LureLanguage)buffer[0]) || (language == LANG_UNKNOWN)) { foundFlag = true; _dataOffset = READ_LE_UINT32(&buffer[1]); _fileHandle->seek(_dataOffset); diff --git a/engines/lure/lure.cpp b/engines/lure/lure.cpp index 4481b2f92e..8e8dd27fee 100644 --- a/engines/lure/lure.cpp +++ b/engines/lure/lure.cpp @@ -186,7 +186,7 @@ bool LureEngine::saveGame(uint8 slotNumber, Common::String &caption) { return false; f->write("lure", 5); - f->writeByte(getLanguage()); + f->writeByte(getLureLanguage()); f->writeByte(LURE_SAVEGAME_MINOR); f->writeString(caption); f->writeByte(0); // End of string terminator @@ -221,7 +221,7 @@ bool LureEngine::loadGame(uint8 slotNumber) { // Check language version uint8 language = f->readByte(); _saveVersion = f->readByte(); - if ((language != getLanguage()) || (_saveVersion < LURE_MIN_SAVEGAME_MINOR)) { + if ((language != getLureLanguage()) || (_saveVersion < LURE_MIN_SAVEGAME_MINOR)) { warning("loadGame: Failed to load slot %d - incorrect version", slotNumber); delete f; return false; @@ -274,7 +274,7 @@ Common::String *LureEngine::detectSave(int slotNumber) { // Check language version uint8 language = f->readByte(); uint8 version = f->readByte(); - if ((language == getLanguage()) && (version >= LURE_MIN_SAVEGAME_MINOR)) { + if ((language == getLureLanguage()) && (version >= LURE_MIN_SAVEGAME_MINOR)) { // Read in the savegame title char saveName[MAX_DESC_SIZE]; char *p = saveName; diff --git a/engines/lure/lure.h b/engines/lure/lure.h index 2641b8f155..bfeaa4c173 100644 --- a/engines/lure/lure.h +++ b/engines/lure/lure.h @@ -54,6 +54,15 @@ namespace Lure { #define RandomNumberGen LureEngine::getReference().rnd() +enum LureLanguage { + LANG_IT_ITA = 10, + LANG_FR_FRA = 6, + LANG_DE_DEU = 7, + LANG_ES_ESP = 17, + LANG_EN_ANY = 3, + LANG_UNKNOWN = -1 +}; + struct LureGameDescription; class LureEngine : public Engine { @@ -107,6 +116,7 @@ public: void GUIError(const char *msg, ...) GCC_PRINTF(2, 3); uint32 getFeatures() const; + LureLanguage getLureLanguage() const; Common::Language getLanguage() const; Common::Platform getPlatform() const; virtual GUI::Debugger *getDebugger(); |