aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2008-10-06 12:48:52 +0000
committerMax Horn2008-10-06 12:48:52 +0000
commit6a2f3dc0b984bcd8bd84d98ae456ed57fca740d6 (patch)
tree6c900838c9aacdaa301ce1bab2e75826f9ec67bc
parent6ca906d7aa4e515d0b0ce9c6a5a38500721d2483 (diff)
downloadscummvm-rg350-6a2f3dc0b984bcd8bd84d98ae456ed57fca740d6.tar.gz
scummvm-rg350-6a2f3dc0b984bcd8bd84d98ae456ed57fca740d6.tar.bz2
scummvm-rg350-6a2f3dc0b984bcd8bd84d98ae456ed57fca740d6.zip
Added new type Engine::Feature; pushed down some #include dependencies
svn-id: r34755
-rw-r--r--engines/agi/agi.cpp1
-rw-r--r--engines/agi/preagi_common.cpp2
-rw-r--r--engines/agi/preagi_mickey.cpp1
-rw-r--r--engines/agi/preagi_troll.cpp2
-rw-r--r--engines/agi/preagi_winnie.cpp1
-rw-r--r--engines/agos/animation.cpp1
-rw-r--r--engines/agos/detection.cpp1
-rw-r--r--engines/cine/cine.cpp1
-rw-r--r--engines/cine/detection.cpp1
-rw-r--r--engines/cine/main_loop.cpp1
-rw-r--r--engines/cine/various.cpp1
-rw-r--r--engines/dialogs.cpp2
-rw-r--r--engines/engine.cpp14
-rw-r--r--engines/engine.h27
-rw-r--r--engines/game.cpp19
-rw-r--r--engines/game.h25
-rw-r--r--engines/gob/gob.cpp1
-rw-r--r--engines/gob/util.cpp2
-rw-r--r--engines/metaengine.h4
-rw-r--r--engines/parallaction/detection.cpp1
-rw-r--r--engines/saga/detection.cpp1
-rw-r--r--engines/touche/detection.cpp1
22 files changed, 75 insertions, 35 deletions
diff --git a/engines/agi/agi.cpp b/engines/agi/agi.cpp
index a17bdc50cf..3c1ec5efde 100644
--- a/engines/agi/agi.cpp
+++ b/engines/agi/agi.cpp
@@ -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"
diff --git a/engines/agi/preagi_common.cpp b/engines/agi/preagi_common.cpp
index ce085ad165..ad26879ca1 100644
--- a/engines/agi/preagi_common.cpp
+++ b/engines/agi/preagi_common.cpp
@@ -30,6 +30,8 @@
#include "agi/preagi_common.h"
+#include "common/events.h"
+
namespace Agi {
// Screen functions
diff --git a/engines/agi/preagi_mickey.cpp b/engines/agi/preagi_mickey.cpp
index db2e01a04b..e942a19d3f 100644
--- a/engines/agi/preagi_mickey.cpp
+++ b/engines/agi/preagi_mickey.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/events.h"
#include "common/savefile.h"
#include "common/stream.h"
diff --git a/engines/agi/preagi_troll.cpp b/engines/agi/preagi_troll.cpp
index db663797f9..1806c35662 100644
--- a/engines/agi/preagi_troll.cpp
+++ b/engines/agi/preagi_troll.cpp
@@ -28,6 +28,8 @@
#include "agi/preagi_troll.h"
#include "agi/graphics.h"
+#include "common/events.h"
+
#include "graphics/cursorman.h"
namespace Agi {
diff --git a/engines/agi/preagi_winnie.cpp b/engines/agi/preagi_winnie.cpp
index c58d7518ac..38e711c330 100644
--- a/engines/agi/preagi_winnie.cpp
+++ b/engines/agi/preagi_winnie.cpp
@@ -29,6 +29,7 @@
#include "graphics/cursorman.h"
+#include "common/events.h"
#include "common/savefile.h"
#include "common/stream.h"
diff --git a/engines/agos/animation.cpp b/engines/agos/animation.cpp
index 9f8b3f8643..c39e476d5e 100644
--- a/engines/agos/animation.cpp
+++ b/engines/agos/animation.cpp
@@ -26,6 +26,7 @@
#include "common/endian.h"
+#include "common/events.h"
#include "common/system.h"
#include "graphics/cursorman.h"
diff --git a/engines/agos/detection.cpp b/engines/agos/detection.cpp
index 12f281d0dc..6cc4d16044 100644
--- a/engines/agos/detection.cpp
+++ b/engines/agos/detection.cpp
@@ -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"
diff --git a/engines/cine/cine.cpp b/engines/cine/cine.cpp
index 2c0fdc7d88..d12ba61480 100644
--- a/engines/cine/cine.cpp
+++ b/engines/cine/cine.cpp
@@ -23,6 +23,7 @@
*
*/
+#include "common/events.h"
#include "common/file.h"
#include "common/savefile.h"
#include "common/config-manager.h"
diff --git a/engines/cine/detection.cpp b/engines/cine/detection.cpp
index 91ef964a0b..97299d266c 100644
--- a/engines/cine/detection.cpp
+++ b/engines/cine/detection.cpp
@@ -28,6 +28,7 @@
#include "base/plugins.h"
#include "common/advancedDetector.h"
+#include "common/system.h"
#include "cine/cine.h"
diff --git a/engines/cine/main_loop.cpp b/engines/cine/main_loop.cpp
index abebe90299..e88340479f 100644
--- a/engines/cine/main_loop.cpp
+++ b/engines/cine/main_loop.cpp
@@ -25,6 +25,7 @@
#include "common/scummsys.h"
+#include "common/events.h"
#include "common/system.h"
#include "cine/main_loop.h"
diff --git a/engines/cine/various.cpp b/engines/cine/various.cpp
index 92fd35d865..1bd3d3967c 100644
--- a/engines/cine/various.cpp
+++ b/engines/cine/various.cpp
@@ -25,6 +25,7 @@
#include "common/endian.h"
+#include "common/events.h"
#include "common/savefile.h"
#include "cine/cine.h"
diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp
index 9f073cd545..92932c8964 100644
--- a/engines/dialogs.cpp
+++ b/engines/dialogs.cpp
@@ -103,7 +103,7 @@ MainMenuDialog::MainMenuDialog(Engine *engine)
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');
diff --git a/engines/engine.cpp b/engines/engine.cpp
index c99187d2f2..a17f1e5153 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -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 @@ void Engine::quitGame() {
_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) );
}
diff --git a/engines/engine.h b/engines/engine.h
index 2bc44ab415..69caafac49 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -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 @@ protected:
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 @@ public:
* 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 @@ public:
*/
void openMainMenuDialog();
+
+ /**
+ * 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 MetaEngine feature.
+ * 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:
diff --git a/engines/game.cpp b/engines/game.cpp
index b3cb140e0a..5011685412 100644
--- a/engines/game.cpp
+++ b/engines/game.cpp
@@ -38,6 +38,25 @@ const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const Pla
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
diff --git a/engines/game.h b/engines/game.h
index a1eed7acd9..a07a71b7e6 100644
--- a/engines/game.h
+++ b/engines/game.h
@@ -62,25 +62,12 @@ const PlainGameDescriptor *findPlainGameDescriptor(const char *gameid, const Pla
*/
class GameDescriptor : public Common::StringMap {
public:
- GameDescriptor() {
- setVal("gameid", "");
- setVal("description", "");
- }
-
- 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));
- }
+ 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);
/**
* Update the description string by appending (LANG/PLATFORM/EXTRA) to it.
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp
index 7e364e891d..e1543e9277 100644
--- a/engines/gob/gob.cpp
+++ b/engines/gob/gob.cpp
@@ -24,6 +24,7 @@
*/
#include "common/endian.h"
+#include "common/events.h"
#include "base/plugins.h"
#include "common/config-manager.h"
diff --git a/engines/gob/util.cpp b/engines/gob/util.cpp
index c3c874b2fb..f04818d4a7 100644
--- a/engines/gob/util.cpp
+++ b/engines/gob/util.cpp
@@ -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) {
diff --git a/engines/metaengine.h b/engines/metaengine.h
index 542cee683b..194acc94d7 100644
--- a/engines/metaengine.h
+++ b/engines/metaengine.h
@@ -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 @@ class OSystem;
namespace Common {
class FSList;
+ class String;
}
/**
@@ -134,7 +134,7 @@ public:
*/
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,
diff --git a/engines/parallaction/detection.cpp b/engines/parallaction/detection.cpp
index d2444c642e..cbaa994e47 100644
--- a/engines/parallaction/detection.cpp
+++ b/engines/parallaction/detection.cpp
@@ -27,6 +27,7 @@
#include "common/config-manager.h"
#include "common/advancedDetector.h"
+#include "common/system.h"
#include "parallaction/parallaction.h"
diff --git a/engines/saga/detection.cpp b/engines/saga/detection.cpp
index 4a10261d9b..57979ab008 100644
--- a/engines/saga/detection.cpp
+++ b/engines/saga/detection.cpp
@@ -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"
diff --git a/engines/touche/detection.cpp b/engines/touche/detection.cpp
index bbc605ba46..72676fd930 100644
--- a/engines/touche/detection.cpp
+++ b/engines/touche/detection.cpp
@@ -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"