[Scummvm-cvs-logs] CVS: scummvm/queen queen.cpp,1.52,1.53 queen.h,1.18,1.19 resource.cpp,1.31,1.32 resource.h,1.21,1.22

Max Horn fingolfin at users.sourceforge.net
Fri Dec 12 07:31:01 CET 2003


Update of /cvsroot/scummvm/scummvm/queen
In directory sc8-pr-cvs1:/tmp/cvs-serv8022

Modified Files:
	queen.cpp queen.h resource.cpp resource.h 
Log Message:
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

Index: queen.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.cpp,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- queen.cpp	11 Dec 2003 22:16:35 -0000	1.52
+++ queen.cpp	12 Dec 2003 15:29:58 -0000	1.53
@@ -51,37 +51,28 @@
 
 #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 @@
 	_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::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);

Index: queen.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/queen.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- queen.h	11 Dec 2003 22:16:35 -0000	1.18
+++ queen.h	12 Dec 2003 15:29:58 -0000	1.19
@@ -73,8 +73,6 @@
 	Resource *_resource;
 	Sound *_sound;
 	Walk *_walk;
-	
-	const char *_detectname; // necessary for music
 };
 
 } // End of namespace Queen

Index: resource.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/resource.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- resource.cpp	11 Dec 2003 21:04:02 -0000	1.31
+++ resource.cpp	12 Dec 2003 15:29:58 -0000	1.32
@@ -42,13 +42,15 @@
 };
 
 
-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();

Index: resource.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/queen/resource.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- resource.h	11 Dec 2003 21:04:02 -0000	1.21
+++ resource.h	12 Dec 2003 15:29:58 -0000	1.22
@@ -63,7 +63,7 @@
 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);





More information about the Scummvm-git-logs mailing list