From 8f5c14aebe0ca423ede54e36d16d626bfab110ed Mon Sep 17 00:00:00 2001 From: Max Horn Date: Fri, 12 Dec 2003 15:29:58 +0000 Subject: get rid of queencomp target (rather simply always check for both queen.1 and queen.1c); this allows some code simplification and gets rid of the last access to detector->_game in queen svn-id: r11599 --- queen/queen.cpp | 34 ++++++++++++---------------------- queen/queen.h | 2 -- queen/resource.cpp | 8 +++++--- queen/resource.h | 2 +- 4 files changed, 18 insertions(+), 28 deletions(-) diff --git a/queen/queen.cpp b/queen/queen.cpp index 7003b8e5bc..9d62844842 100644 --- a/queen/queen.cpp +++ b/queen/queen.cpp @@ -51,37 +51,28 @@ extern bool draw_keyboard; #endif -static const GameSettings queen_settings[] = { - /* Flight of the Amazon Queen */ - { "queen", "Flight of the Amazon Queen", MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1" }, - { "queencomp", "Flight of the Amazon Queen", MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1c" }, - { NULL, NULL, MDT_NONE, 0, NULL} -}; +/* Flight of the Amazon Queen */ +static const GameSettings queen_setting = + { "queen", "Flight of the Amazon Queen", MDT_ADLIB | MDT_NATIVE | MDT_PREFER_NATIVE, 0, "queen.1" }; GameList Engine_QUEEN_gameList() { - const GameSettings *g = queen_settings; GameList games; - while (g->gameName) - games.push_back(*g++); + games.push_back(queen_setting); return games; } GameList Engine_QUEEN_detectGames(const FSList &fslist) { GameList detectedGames; - const GameSettings *g = &queen_settings[0]; - while(g->detectname) { - // Iterate over all files in the given directory - for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) { - const char *gameName = file->displayName().c_str(); + // Iterate over all files in the given directory + for (FSList::ConstIterator file = fslist.begin(); file != fslist.end(); ++file) { + const char *gameName = file->displayName().c_str(); - if (0 == scumm_stricmp(g->detectname, gameName)) { - // Match found, add to list of candidates, then abort inner loop. - detectedGames.push_back(*g); - break; - } + if (0 == scumm_stricmp("queen.1", gameName) || 0 == scumm_stricmp("queen.1c", gameName)) { + // Match found, add to list of candidates, then abort loop. + detectedGames.push_back(queen_setting); + break; } - g++; } return detectedGames; } @@ -103,7 +94,6 @@ QueenEngine::QueenEngine(GameDetector *detector, OSystem *syst) _mixer->setVolume(ConfMan.getInt("sfx_volume")); _debugLevel = ConfMan.getInt("debuglevel"); - _detectname = detector->_game.detectname; _system->init_size(320, 200); } @@ -167,7 +157,7 @@ void QueenEngine::go() { void QueenEngine::initialise(void) { - _resource = new Resource(_gameDataPath, _detectname, _system->get_savefile_manager(), getSavePath()); + _resource = new Resource(_gameDataPath, _system->get_savefile_manager(), getSavePath()); _command = new Command(this); _display = new Display(this, _resource->getLanguage(), _system); _graphics = new Graphics(this); diff --git a/queen/queen.h b/queen/queen.h index a6bab365e5..1fe5ad997f 100644 --- a/queen/queen.h +++ b/queen/queen.h @@ -73,8 +73,6 @@ protected: Resource *_resource; Sound *_sound; Walk *_walk; - - const char *_detectname; // necessary for music }; } // End of namespace Queen diff --git a/queen/resource.cpp b/queen/resource.cpp index c7d2a6acdc..9133c3c7f0 100644 --- a/queen/resource.cpp +++ b/queen/resource.cpp @@ -42,13 +42,15 @@ const GameVersion Resource::_gameVersions[] = { }; -Resource::Resource(const Common::String &datafilePath, const char *datafileName, SaveFileManager *mgr, const char *savePath) +Resource::Resource(const Common::String &datafilePath, SaveFileManager *mgr, const char *savePath) : _JAS2Pos(0), _datafilePath(datafilePath), _savePath(savePath), _resourceEntries(0), _resourceTable(NULL), _saveFileManager(mgr) { _resourceFile = new File(); - _resourceFile->open(datafileName, _datafilePath); + _resourceFile->open("queen.1", _datafilePath); if (_resourceFile->isOpen() == false) - error("Could not open resource file '%s%s'", _datafilePath.c_str(), datafileName); + _resourceFile->open("queen.1c", _datafilePath); + if (_resourceFile->isOpen() == false) + error("Could not open resource file '%s%s'", _datafilePath.c_str(), "queen.1"); if (_resourceFile->readUint32BE() == 'QTBL') { readTableCompResource(); diff --git a/queen/resource.h b/queen/resource.h index d23e05b446..c02033b808 100644 --- a/queen/resource.h +++ b/queen/resource.h @@ -63,7 +63,7 @@ struct GameVersion { class Resource { public: - Resource(const Common::String &datafilePath, const char *datafileName, SaveFileManager *mgr, const char *savePath); + Resource(const Common::String &datafilePath, SaveFileManager *mgr, const char *savePath); ~Resource(void); uint8 *loadFile(const char *filename, uint32 skipBytes = 0, byte *dstBuf = NULL); uint8 *loadFileMalloc(const char *filename, uint32 skipBytes = 0, byte *dstBuf = NULL); -- cgit v1.2.3