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
This commit is contained in:
Max Horn 2003-12-12 15:29:58 +00:00
parent 0b22651494
commit 8f5c14aebe
4 changed files with 18 additions and 28 deletions

View File

@ -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);

View File

@ -73,8 +73,6 @@ protected:
Resource *_resource;
Sound *_sound;
Walk *_walk;
const char *_detectname; // necessary for music
};
} // End of namespace Queen

View File

@ -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();

View File

@ -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);