[Scummvm-cvs-logs] SF.net SVN: scummvm: [25138] scummvm/trunk/base
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Sun Jan 21 01:29:04 CET 2007
Revision: 25138
http://scummvm.svn.sourceforge.net/scummvm/?rev=25138&view=rev
Author: fingolfin
Date: 2007-01-20 16:29:03 -0800 (Sat, 20 Jan 2007)
Log Message:
-----------
Make use of HashMap::getVal/setVal, and some cleanup
Modified Paths:
--------------
scummvm/trunk/base/commandLine.cpp
scummvm/trunk/base/game.cpp
scummvm/trunk/base/game.h
Modified: scummvm/trunk/base/commandLine.cpp
===================================================================
--- scummvm/trunk/base/commandLine.cpp 2007-01-21 00:25:04 UTC (rev 25137)
+++ scummvm/trunk/base/commandLine.cpp 2007-01-21 00:29:03 UTC (rev 25138)
@@ -550,8 +550,8 @@
// 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());
Modified: scummvm/trunk/base/game.cpp
===================================================================
--- scummvm/trunk/base/game.cpp 2007-01-21 00:25:04 UTC (rev 25137)
+++ scummvm/trunk/base/game.cpp 2007-01-21 00:29:03 UTC (rev 25138)
@@ -28,21 +28,21 @@
// 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 @@
descr += extra;
}
descr += ")";
- this->operator []("description") = descr;
+ setVal("description", descr);
}
}
Modified: scummvm/trunk/base/game.h
===================================================================
--- scummvm/trunk/base/game.h 2007-01-21 00:25:04 UTC (rev 25137)
+++ scummvm/trunk/base/game.h 2007-01-21 00:29:03 UTC (rev 25138)
@@ -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 @@
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 @@
*/
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. */
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