diff options
author | Max Horn | 2006-06-05 17:43:30 +0000 |
---|---|---|
committer | Max Horn | 2006-06-05 17:43:30 +0000 |
commit | 0f18020010d36f4dce5e73edc3fd4f87c434e5e1 (patch) | |
tree | 3dfcf6bb4fea8daa8478c826520797f42444aa55 /gui/ThemeNew.cpp | |
parent | 6d0a06463a56df53571c8a41ff72512d91fb710a (diff) | |
download | scummvm-rg350-0f18020010d36f4dce5e73edc3fd4f87c434e5e1.tar.gz scummvm-rg350-0f18020010d36f4dce5e73edc3fd4f87c434e5e1.tar.bz2 scummvm-rg350-0f18020010d36f4dce5e73edc3fd4f87c434e5e1.zip |
Some more string usage tweaks
svn-id: r22936
Diffstat (limited to 'gui/ThemeNew.cpp')
-rw-r--r-- | gui/ThemeNew.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp index 1a33eaec5c..300e15661e 100644 --- a/gui/ThemeNew.cpp +++ b/gui/ThemeNew.cpp @@ -51,11 +51,10 @@ extern int gBitFormat; 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 getColorFromConfig(const Common::ConfigFile &cfg, const Common::Stri } 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 @@ void ThemeNew::drawPopUpWidget(const Common::Rect &r, const Common::String &sel, 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); } |