aboutsummaryrefslogtreecommitdiff
path: root/base/plugins.cpp
diff options
context:
space:
mode:
authorEugene Sandulenko2007-01-20 21:27:57 +0000
committerEugene Sandulenko2007-01-20 21:27:57 +0000
commitcd8a5f3a98287fe7366db100c2fb45ff986e2d1b (patch)
treec3acca9454ff39fc71da8444eb98494683a6261f /base/plugins.cpp
parent47b1321d1520eabcfa4d971bd945f4461eeada49 (diff)
downloadscummvm-rg350-cd8a5f3a98287fe7366db100c2fb45ff986e2d1b.tar.gz
scummvm-rg350-cd8a5f3a98287fe7366db100c2fb45ff986e2d1b.tar.bz2
scummvm-rg350-cd8a5f3a98287fe7366db100c2fb45ff986e2d1b.zip
First phase of detection-related plugins interface improvements. Now plugins
return StringMap instead of fixed list of parameters. This adds great flexibility. Current patch should not alter any functionality, i.e. if there are regressions, submit a report. Phase 2 will benefit from these changes and will come later. svn-id: r25134
Diffstat (limited to 'base/plugins.cpp')
-rw-r--r--base/plugins.cpp29
1 files changed, 16 insertions, 13 deletions
diff --git a/base/plugins.cpp b/base/plugins.cpp
index 9f53a66f74..90cbb5de78 100644
--- a/base/plugins.cpp
+++ b/base/plugins.cpp
@@ -25,30 +25,33 @@
#include "common/util.h"
-void DetectedGame::updateDesc(const char *extra) {
+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
// the seperator (instead of '/' use ', ' or ' ').
- const bool hasCustomLanguage = (language != Common::UNK_LANG);
- const bool hasCustomPlatform = (platform != Common::kPlatformUnknown);
+ const bool hasCustomLanguage = (this->contains("language") && (this->language() != Common::UNK_LANG));
+ const bool hasCustomPlatform = (this->contains("platform") && (this->platform() != Common::kPlatformUnknown));
const bool hasExtraDesc = (extra && extra[0]);
// Adapt the description string if custom platform/language is set.
if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) {
- description += " (";
+ Common::String descr = this->description();
+
+ descr += " (";
if (hasCustomLanguage)
- description += Common::getLanguageDescription(language);
+ descr += Common::getLanguageDescription(this->language());
if (hasCustomPlatform) {
if (hasCustomLanguage)
- description += "/";
- description += Common::getPlatformDescription(platform);
+ descr += "/";
+ descr += Common::getPlatformDescription(this->platform());
}
if (hasExtraDesc) {
if (hasCustomPlatform || hasCustomLanguage)
- description += "/";
- description += extra;
+ descr += "/";
+ descr += extra;
}
- description += ")";
+ descr += ")";
+ this->operator []("description") = descr;
}
}
@@ -86,7 +89,7 @@ public:
return (*_plugin->_qf)(gameid);
}
- DetectedGameList detectGames(const FSList &fslist) const {
+ GameList detectGames(const FSList &fslist) const {
assert(_plugin->_df);
return (*_plugin->_df)(fslist);
}
@@ -247,8 +250,8 @@ bool PluginManager::tryLoadPlugin(Plugin *plugin) {
}
}
-DetectedGameList PluginManager::detectGames(const FSList &fslist) const {
- DetectedGameList candidates;
+GameList PluginManager::detectGames(const FSList &fslist) const {
+ GameList candidates;
// Iterate over all known games and for each check if it might be
// the game in the presented directory.