[Scummvm-cvs-logs] SF.net SVN: scummvm:[34755] scummvm/trunk/engines

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Mon Oct 6 14:48:53 CEST 2008


Revision: 34755
          http://scummvm.svn.sourceforge.net/scummvm/?rev=34755&view=rev
Author:   fingolfin
Date:     2008-10-06 12:48:52 +0000 (Mon, 06 Oct 2008)

Log Message:
-----------
Added new type Engine::Feature; pushed down some #include dependencies

Modified Paths:
--------------
    scummvm/trunk/engines/agi/agi.cpp
    scummvm/trunk/engines/agi/preagi_common.cpp
    scummvm/trunk/engines/agi/preagi_mickey.cpp
    scummvm/trunk/engines/agi/preagi_troll.cpp
    scummvm/trunk/engines/agi/preagi_winnie.cpp
    scummvm/trunk/engines/agos/animation.cpp
    scummvm/trunk/engines/agos/detection.cpp
    scummvm/trunk/engines/cine/cine.cpp
    scummvm/trunk/engines/cine/detection.cpp
    scummvm/trunk/engines/cine/main_loop.cpp
    scummvm/trunk/engines/cine/various.cpp
    scummvm/trunk/engines/dialogs.cpp
    scummvm/trunk/engines/engine.cpp
    scummvm/trunk/engines/engine.h
    scummvm/trunk/engines/game.cpp
    scummvm/trunk/engines/game.h
    scummvm/trunk/engines/gob/gob.cpp
    scummvm/trunk/engines/gob/util.cpp
    scummvm/trunk/engines/metaengine.h
    scummvm/trunk/engines/parallaction/detection.cpp
    scummvm/trunk/engines/saga/detection.cpp
    scummvm/trunk/engines/touche/detection.cpp

Modified: scummvm/trunk/engines/agi/agi.cpp
===================================================================
--- scummvm/trunk/engines/agi/agi.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/agi/agi.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -25,6 +25,7 @@
 
 
 #include "common/md5.h"
+#include "common/events.h"
 #include "common/file.h"
 #include "common/savefile.h"
 #include "common/config-manager.h"

Modified: scummvm/trunk/engines/agi/preagi_common.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_common.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/agi/preagi_common.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -30,6 +30,8 @@
 
 #include "agi/preagi_common.h"
 
+#include "common/events.h"
+
 namespace Agi {
 
 // Screen functions

Modified: scummvm/trunk/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_mickey.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/agi/preagi_mickey.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "common/events.h"
 #include "common/savefile.h"
 #include "common/stream.h"
 

Modified: scummvm/trunk/engines/agi/preagi_troll.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_troll.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/agi/preagi_troll.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -28,6 +28,8 @@
 #include "agi/preagi_troll.h"
 #include "agi/graphics.h"
 
+#include "common/events.h"
+
 #include "graphics/cursorman.h"
 
 namespace Agi {

Modified: scummvm/trunk/engines/agi/preagi_winnie.cpp
===================================================================
--- scummvm/trunk/engines/agi/preagi_winnie.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/agi/preagi_winnie.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -29,6 +29,7 @@
 
 #include "graphics/cursorman.h"
 
+#include "common/events.h"
 #include "common/savefile.h"
 #include "common/stream.h"
 

Modified: scummvm/trunk/engines/agos/animation.cpp
===================================================================
--- scummvm/trunk/engines/agos/animation.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/agos/animation.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -26,6 +26,7 @@
 
 
 #include "common/endian.h"
+#include "common/events.h"
 #include "common/system.h"
 
 #include "graphics/cursorman.h"

Modified: scummvm/trunk/engines/agos/detection.cpp
===================================================================
--- scummvm/trunk/engines/agos/detection.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/agos/detection.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -28,6 +28,7 @@
 #include "common/advancedDetector.h"
 #include "common/config-manager.h"
 #include "common/savefile.h"
+#include "common/system.h"
 
 #include "agos/agos.h"
 

Modified: scummvm/trunk/engines/cine/cine.cpp
===================================================================
--- scummvm/trunk/engines/cine/cine.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/cine/cine.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -23,6 +23,7 @@
  *
  */
 
+#include "common/events.h"
 #include "common/file.h"
 #include "common/savefile.h"
 #include "common/config-manager.h"

Modified: scummvm/trunk/engines/cine/detection.cpp
===================================================================
--- scummvm/trunk/engines/cine/detection.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/cine/detection.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -28,6 +28,7 @@
 #include "base/plugins.h"
 
 #include "common/advancedDetector.h"
+#include "common/system.h"
 
 #include "cine/cine.h"
 

Modified: scummvm/trunk/engines/cine/main_loop.cpp
===================================================================
--- scummvm/trunk/engines/cine/main_loop.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/cine/main_loop.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -25,6 +25,7 @@
 
 
 #include "common/scummsys.h"
+#include "common/events.h"
 #include "common/system.h"
 
 #include "cine/main_loop.h"

Modified: scummvm/trunk/engines/cine/various.cpp
===================================================================
--- scummvm/trunk/engines/cine/various.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/cine/various.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -25,6 +25,7 @@
 
 
 #include "common/endian.h"
+#include "common/events.h"
 #include "common/savefile.h"
 
 #include "cine/cine.h"

Modified: scummvm/trunk/engines/dialogs.cpp
===================================================================
--- scummvm/trunk/engines/dialogs.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/dialogs.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -103,7 +103,7 @@
 	new GUI::ButtonWidget(this, "globalmain_about", "About", kAboutCmd, 'A');
 
 	_rtlButton = new GUI::ButtonWidget(this, "globalmain_rtl", "Return to Launcher", kRTLCmd, 'R');	
-	_rtlButton->setEnabled(_engine->hasFeature(MetaEngine::kSupportsRTL));
+	_rtlButton->setEnabled(_engine->hasFeature(Engine::kSupportsRTL));
 
 
 	new GUI::ButtonWidget(this, "globalmain_quit", "Quit", kQuitCmd, 'Q');

Modified: scummvm/trunk/engines/engine.cpp
===================================================================
--- scummvm/trunk/engines/engine.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/engine.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -31,6 +31,7 @@
 
 #include "engines/engine.h"
 #include "common/config-manager.h"
+#include "common/events.h"
 #include "common/file.h"
 #include "common/timer.h"
 #include "common/savefile.h"
@@ -250,13 +251,20 @@
 	_eventMan->pushEvent(event);
 }
 
-bool Engine::hasFeature(MetaEngine::MetaEngineFeature f) {
-	// TODO: In each engine, keep a ref to the corresponding MetaEngine?
+bool Engine::shouldQuit() const {
+	return (_eventMan->shouldQuit() || _eventMan->shouldRTL());
+}
+
+bool Engine::hasFeature(EngineFeature f) {
+	// TODO: Get rid of this hack!!!
+	if (f != kSupportsRTL)
+		return false;
+
 	const EnginePlugin *plugin = 0;
 	Common::String gameid = ConfMan.get("gameid");
 	gameid.toLowercase();
 	EngineMan.findGame(gameid, &plugin);
 	assert(plugin);
-	return ( (*plugin)->hasFeature(f) );
+	return ( (*plugin)->hasFeature(MetaEngine::kSupportsRTL) );
 }
 

Modified: scummvm/trunk/engines/engine.h
===================================================================
--- scummvm/trunk/engines/engine.h	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/engine.h	2008-10-06 12:48:52 UTC (rev 34755)
@@ -26,12 +26,9 @@
 #define ENGINES_ENGINE_H
 
 #include "common/scummsys.h"
-#include "common/events.h"
 #include "common/fs.h"
 #include "common/str.h"
 
-#include "engines/metaengine.h"
-
 class OSystem;
 
 namespace Audio {
@@ -73,7 +70,7 @@
 
 	const Common::String _targetName; // target name for saves
 	
-	const Common::FSNode _gameDataDir;
+	const Common::FSNode _gameDataDir;	// FIXME: Get rid of this
 
 private:
 	/**
@@ -151,7 +148,7 @@
 	 * Return whether the ENGINE should quit respectively should return to the
 	 * launcher.
 	 */
-	bool shouldQuit() const { return (_eventMan->shouldQuit() || _eventMan->shouldRTL()); }
+	bool shouldQuit() const;
 
 	/**
 	 * Pause or resume the engine. This should stop/resume any audio playback
@@ -176,14 +173,24 @@
 	 */
 	void openMainMenuDialog();
 
+
 	/**
-	 * Determine whether the engine supports the specified MetaEngine feature.
+	 * A feature in this context means an ability of the engine which can be
+	 * either available or not.
+	 */
+	enum EngineFeature {
+		/**
+		 * 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled.
+		 */
+		kSupportsRTL
+	};
+
+	/**
+	 * Determine whether the engine supports the specified feature.
 	 *
-	 * FIXME: This should not call through to the MetaEngine, but rather should support
-	 * its own list of features. In particular, kSupportsRTL should be an EngineFeature,
-	 * not a MetaEngineFeature.
+	 * @todo  Let this return false by default, or even turn it into a pure virtual method.
 	 */
-	bool hasFeature(MetaEngine::MetaEngineFeature f);
+	bool hasFeature(EngineFeature f);
 
 public:
 

Modified: scummvm/trunk/engines/game.cpp
===================================================================
--- scummvm/trunk/engines/game.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/game.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -38,6 +38,25 @@
 	return 0;
 }
 
+GameDescriptor::GameDescriptor() {
+	setVal("gameid", "");
+	setVal("description", "");
+}
+
+GameDescriptor::GameDescriptor(const PlainGameDescriptor &pgd) {
+	setVal("gameid", pgd.gameid);
+	setVal("description", pgd.description);
+}
+
+GameDescriptor::GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l, Common::Platform p) {
+	setVal("gameid", g);
+	setVal("description", d);
+	if (l != Common::UNK_LANG)
+		setVal("language", Common::getLanguageCode(l));
+	if (p != Common::kPlatformUnknown)
+		setVal("platform", Common::getPlatformCode(p));
+}
+
 void GameDescriptor::updateDesc(const char *extra) {
 	// TODO: The format used here (LANG/PLATFORM/EXTRA) is not set in stone.
 	// We may want to change the order (PLATFORM/EXTRA/LANG, anybody?), or

Modified: scummvm/trunk/engines/game.h
===================================================================
--- scummvm/trunk/engines/game.h	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/game.h	2008-10-06 12:48:52 UTC (rev 34755)
@@ -62,26 +62,13 @@
  */
 class GameDescriptor : public Common::StringMap {
 public:
-	GameDescriptor() {
-		setVal("gameid", "");
-		setVal("description", "");
-	}
+	GameDescriptor();
+	GameDescriptor(const PlainGameDescriptor &pgd);
+	GameDescriptor(const Common::String &gameid,
+	              const Common::String &description,
+	              Common::Language language = Common::UNK_LANG,
+	              Common::Platform platform = Common::kPlatformUnknown);
 
-	GameDescriptor(const PlainGameDescriptor &pgd) {
-		setVal("gameid", pgd.gameid);
-		setVal("description", pgd.description);
-	}
-
-	GameDescriptor(const Common::String &g, const Common::String &d, Common::Language l  = Common::UNK_LANG,
-	             Common::Platform p = Common::kPlatformUnknown) {
-		setVal("gameid", g);
-		setVal("description", d);
-		if (l != Common::UNK_LANG)
-			setVal("language", Common::getLanguageCode(l));
-		if (p != Common::kPlatformUnknown)
-			setVal("platform", Common::getPlatformCode(p));
-	}
-
 	/**
 	 * Update the description string by appending (LANG/PLATFORM/EXTRA) to it.
 	 */

Modified: scummvm/trunk/engines/gob/gob.cpp
===================================================================
--- scummvm/trunk/engines/gob/gob.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/gob/gob.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -24,6 +24,7 @@
  */
 
 #include "common/endian.h"
+#include "common/events.h"
 
 #include "base/plugins.h"
 #include "common/config-manager.h"

Modified: scummvm/trunk/engines/gob/util.cpp
===================================================================
--- scummvm/trunk/engines/gob/util.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/gob/util.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -33,6 +33,8 @@
 #include "gob/video.h"
 #include "gob/sound/sound.h"
 
+#include "common/events.h"
+
 namespace Gob {
 
 Util::Util(GobEngine *vm) : _vm(vm) {

Modified: scummvm/trunk/engines/metaengine.h
===================================================================
--- scummvm/trunk/engines/metaengine.h	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/metaengine.h	2008-10-06 12:48:52 UTC (rev 34755)
@@ -26,7 +26,6 @@
 #define ENGINES_METAENGINE_H
 
 #include "common/scummsys.h"
-#include "common/str.h"
 #include "common/error.h"
 
 #include "engines/game.h"
@@ -37,6 +36,7 @@
 
 namespace Common {
 	class FSList;
+	class String;
 }
 
 /**
@@ -134,7 +134,7 @@
 	 */
 	enum MetaEngineFeature {
 		/**
-		 * 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled-
+		 * 'Return to launcher' feature is supported, i.e., EVENT_RTL is handled.
 		 */
 		kSupportsRTL,
 

Modified: scummvm/trunk/engines/parallaction/detection.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/detection.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/parallaction/detection.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -27,6 +27,7 @@
 
 #include "common/config-manager.h"
 #include "common/advancedDetector.h"
+#include "common/system.h"
 
 #include "parallaction/parallaction.h"
 

Modified: scummvm/trunk/engines/saga/detection.cpp
===================================================================
--- scummvm/trunk/engines/saga/detection.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/saga/detection.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -31,6 +31,7 @@
 
 #include "common/config-manager.h"
 #include "common/advancedDetector.h"
+#include "common/system.h"
 
 #include "saga/displayinfo.h"
 #include "saga/rscfile.h"

Modified: scummvm/trunk/engines/touche/detection.cpp
===================================================================
--- scummvm/trunk/engines/touche/detection.cpp	2008-10-06 11:28:09 UTC (rev 34754)
+++ scummvm/trunk/engines/touche/detection.cpp	2008-10-06 12:48:52 UTC (rev 34755)
@@ -26,6 +26,7 @@
 #include "common/config-manager.h"
 #include "common/advancedDetector.h"
 #include "common/savefile.h"
+#include "common/system.h"
 
 #include "base/plugins.h"
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list