diff options
| -rw-r--r-- | base/commandLine.cpp | 4 | ||||
| -rw-r--r-- | base/game.cpp | 12 | ||||
| -rw-r--r-- | base/game.h | 21 | 
3 files changed, 19 insertions, 18 deletions
| diff --git a/base/commandLine.cpp b/base/commandLine.cpp index 46c45bb5d1..86168e94e1 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -550,8 +550,8 @@ static void listTargets() {  			// be taken into account, too.  			Common::String gameid(name);  			GameDescriptor g = Base::findGame(gameid); -			if (g["description"].size() > 0) -				description = g["description"]; +			if (g.description().size() > 0) +				description = g.description();  		}  		printf("%-20s %s\n", name.c_str(), description.c_str()); diff --git a/base/game.cpp b/base/game.cpp index b5a381f10f..a20acaae95 100644 --- a/base/game.cpp +++ b/base/game.cpp @@ -28,21 +28,21 @@ 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 = (this->contains("language") && (this->language() != Common::UNK_LANG)); -	const bool hasCustomPlatform = (this->contains("platform") && (this->platform() != Common::kPlatformUnknown)); +	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) { -		Common::String descr = this->description(); +		Common::String descr = description();  		descr += " (";  		if (hasCustomLanguage) -			descr += Common::getLanguageDescription(this->language()); +			descr += Common::getLanguageDescription(language());  		if (hasCustomPlatform) {  			if (hasCustomLanguage)  				descr += "/"; -			descr += Common::getPlatformDescription(this->platform()); +			descr += Common::getPlatformDescription(platform());  		}  		if (hasExtraDesc) {  			if (hasCustomPlatform || hasCustomLanguage) @@ -50,7 +50,7 @@ void GameDescriptor::updateDesc(const char *extra) {  			descr += extra;  		}  		descr += ")"; -		this->operator []("description") = descr; +		setVal("description", descr);  	}  } diff --git a/base/game.h b/base/game.h index 566a63706b..1f45af259c 100644 --- a/base/game.h +++ b/base/game.h @@ -24,6 +24,7 @@  #ifndef BASE_GAME_H  #define BASE_GAME_H +#include "common/stdafx.h"  #include "common/str.h"  #include "common/array.h"  #include "common/hash-str.h" @@ -38,18 +39,18 @@ public:  	GameDescriptor() {}  	GameDescriptor(const PlainGameDescriptor &pgd) { -		this->operator []("gameid") = pgd.gameid; -		this->operator []("description") = pgd.description; +		setVal("gameid", pgd.gameid); +		setVal("description", pgd.description);  	}  	GameDescriptor(Common::String g, Common::String d, Common::Language l  = Common::UNK_LANG,  	             Common::Platform p = Common::kPlatformUnknown) { -		this->operator []("gameid") = g; -		this->operator []("description") = d; +		setVal("gameid", g); +		setVal("description", d);  		if (l != Common::UNK_LANG) -			this->operator []("language") = Common::getLanguageCode(l); +			setVal("language", Common::getLanguageCode(l));  		if (p != Common::kPlatformUnknown) -			this->operator []("platform") = Common::getPlatformCode(p); +			setVal("platform", Common::getPlatformCode(p));  	}  	/** @@ -57,10 +58,10 @@ public:  	 */  	void updateDesc(const char *extra = 0); -	Common::String &gameid() { return this->operator []("gameid"); } -	Common::String &description() { return this->operator []("description"); } -	Common::Language language() { return Common::parseLanguage(this->operator []("language")); } -	Common::Platform platform() { return Common::parsePlatform(this->operator []("platform")); } +	Common::String &gameid() { return getVal("gameid"); } +	Common::String &description() { return getVal("description"); } +	Common::Language language() const { return Common::parseLanguage(getVal("language")); } +	Common::Platform platform() const { return Common::parsePlatform(getVal("platform")); }  };  /** List of games. */ | 
