[Scummvm-cvs-logs] SF.net SVN: scummvm: [22936] scummvm/trunk/gui
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Mon Jun 5 19:43:37 CEST 2006
Revision: 22936
Author: fingolfin
Date: 2006-06-05 10:43:30 -0700 (Mon, 05 Jun 2006)
ViewCVS: http://svn.sourceforge.net/scummvm/?rev=22936&view=rev
Log Message:
-----------
Some more string usage tweaks
Modified Paths:
--------------
scummvm/trunk/gui/ThemeNew.cpp
scummvm/trunk/gui/eval.cpp
scummvm/trunk/gui/eval.h
scummvm/trunk/gui/theme-config.cpp
Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp 2006-06-05 17:36:08 UTC (rev 22935)
+++ scummvm/trunk/gui/ThemeNew.cpp 2006-06-05 17:43:30 UTC (rev 22936)
@@ -51,11 +51,10 @@
static void getColorFromConfig(const Common::ConfigFile &cfg, const Common::String &value, OverlayColor &color) {
Common::String temp;
- if (!cfg.hasKey(value, "colors")) {
+ if (!cfg.getKey(value, "colors", temp)) {
color = g_system->RGBToColor(0, 0, 0);
return;
}
- cfg.getKey(value, "colors", temp);
int rgb[3], pos = 0;
const char *colors = temp.c_str();
@@ -68,23 +67,21 @@
}
static void getValueFromConfig(const Common::ConfigFile &cfg, const Common::String §ion, const Common::String &value, uint &val, uint defaultVal) {
- if (!cfg.hasKey(value, section)) {
+ Common::String temp;
+ if (!cfg.getKey(value, section, temp)) {
val = defaultVal;
- return;
+ } else {
+ val = atoi(temp.c_str());
}
- Common::String temp;
- cfg.getKey(value, section, temp);
- val = atoi(temp.c_str());
}
static void getValueFromConfig(const Common::ConfigFile &cfg, const Common::String §ion, const Common::String &value, int &val, int defaultVal) {
- if (!cfg.hasKey(value, section)) {
+ Common::String temp;
+ if (!cfg.getKey(value, section, temp)) {
val = defaultVal;
- return;
+ } else {
+ val = atoi(temp.c_str());
}
- Common::String temp;
- cfg.getKey(value, section, temp);
- val = atoi(temp.c_str());
}
#define getFactorFromConfig(x, y, z) getValueFromConfig(x, "gradients", y, z, 1)
@@ -732,7 +729,7 @@
arrowRect.clip(r);
drawSurface(arrowRect, arrow, true, false, (state == kStateDisabled) ? -30 : 256);
- if (sel != "") {
+ if (!sel.empty()) {
Common::Rect text(r.left + 2, r.top + 3, r.right - 4, r.top + 3 + getFont()->getFontHeight());
getFont()->drawString(&_screen, sel, text.left, text.top, text.width(), getColor(state), convertAligment(align), deltax, false);
}
Modified: scummvm/trunk/gui/eval.cpp
===================================================================
--- scummvm/trunk/gui/eval.cpp 2006-06-05 17:36:08 UTC (rev 22935)
+++ scummvm/trunk/gui/eval.cpp 2006-06-05 17:43:30 UTC (rev 22936)
@@ -317,8 +317,8 @@
return EVAL_UNDEF_VAR;
}
-void Eval::setVar(const String §ion, const char *name, const String &value) {
- _vars[name + 4] = eval(value, section, name, 0);
+void Eval::setVar(const String §ion, const String &name, const String &value) {
+ _vars[name.c_str() + 4] = eval(value, section, name, 0);
}
void Eval::reset() {
Modified: scummvm/trunk/gui/eval.h
===================================================================
--- scummvm/trunk/gui/eval.h 2006-06-05 17:36:08 UTC (rev 22935)
+++ scummvm/trunk/gui/eval.h 2006-06-05 17:43:30 UTC (rev 22936)
@@ -42,11 +42,11 @@
~Eval();
int eval(const String &input, const String §ion, const String &name, int startpos);
- void setVar(const String §ion, const char *name, const String &value);
+ void setVar(const String §ion, const String &name, const String &value);
void setParent(const String &name);
- void setVar(const char *name, int val) { _vars[name] = val; }
+ void setVar(const String &name, int val) { _vars[name.c_str()] = val; }
void setAlias(const char *name, const String &val) { _aliases[name] = val; }
int getVar(const String &s) { return getVar_(s.c_str()); }
Modified: scummvm/trunk/gui/theme-config.cpp
===================================================================
--- scummvm/trunk/gui/theme-config.cpp 2006-06-05 17:36:08 UTC (rev 22935)
+++ scummvm/trunk/gui/theme-config.cpp 2006-06-05 17:43:30 UTC (rev 22936)
@@ -424,13 +424,13 @@
to += postfixes[i];
_evaluator->setAlias(selfpostfixes[i], to);
- _evaluator->setVar(to.c_str(), EVAL_UNDEF_VAR);
+ _evaluator->setVar(to, EVAL_UNDEF_VAR);
}
for (i = 0; i < str.size(); i++) {
if (isspace(str[i]) && level == 0) {
value = _evaluator->eval(String(&(str.c_str()[start]), i - start), section, name + postfixes[npostfix], start);
- _evaluator->setVar((prefixedname + postfixes[npostfix++]).c_str(), value);
+ _evaluator->setVar(prefixedname + postfixes[npostfix++], value);
start = i + 1;
}
if (str[i] == '(')
@@ -453,15 +453,15 @@
// process VAR=VALUE construct
if (npostfix == 0)
- _evaluator->setVar(name.c_str(), value);
+ _evaluator->setVar(name, value);
else
- _evaluator->setVar((prefixedname + postfixes[npostfix]).c_str(), value);
+ _evaluator->setVar(prefixedname + postfixes[npostfix], value);
// If we have all 4 parameters, set .x2 and .y2
if (npostfix == 3) {
- _evaluator->setVar((prefixedname + ".x2").c_str(),
+ _evaluator->setVar(prefixedname + ".x2",
_evaluator->getVar(prefixedname + ".x") + _evaluator->getVar(prefixedname + ".w"));
- _evaluator->setVar((prefixedname + ".y2").c_str(),
+ _evaluator->setVar(prefixedname + ".y2",
_evaluator->getVar(prefixedname + ".y") + _evaluator->getVar(prefixedname + ".h"));
}
@@ -487,7 +487,7 @@
}
if (iterk->key.hasPrefix("def_")) {
if (!skipDefs)
- _evaluator->setVar(name, (prefix + iterk->key).c_str(), iterk->value);
+ _evaluator->setVar(name, prefix + iterk->key, iterk->value);
continue;
}
if (iterk->key == "use") {
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