From 46ee5c8f26b8b53d0c7268a8328edea0b4134611 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Thu, 9 Mar 2006 12:52:10 +0000 Subject: Added new method DetectedGame::updateDesc, to ease generation of uniform description strings svn-id: r21166 --- base/plugins.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'base/plugins.cpp') diff --git a/base/plugins.cpp b/base/plugins.cpp index 0f1fc62b18..80f19bd775 100644 --- a/base/plugins.cpp +++ b/base/plugins.cpp @@ -69,6 +69,37 @@ PluginRegistrator::PluginRegistrator(const char *name, GameList games, GameIDQue #endif +#pragma mark - + + +void DetectedGame::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 hasExtraDesc = (extra && extra[0]); + + // Adapt the description string if custom platform/language is set. + if (hasCustomLanguage || hasCustomPlatform || hasExtraDesc) { + description += " ("; + if (hasCustomLanguage) + description += Common::getLanguageDescription(language); + if (hasCustomPlatform) { + if (hasCustomLanguage) + description += "/"; + description += Common::getPlatformDescription(platform); + } + if (hasExtraDesc) { + if (hasCustomPlatform || hasCustomLanguage) + description += "/"; + description += extra; + } + description += ")"; + } +} + + #pragma mark - #ifndef DYNAMIC_MODULES -- cgit v1.2.3