From 7e73b7cae9faf203e369dc5cf2b85cff6e6efbad Mon Sep 17 00:00:00 2001 From: Sfan5 Date: Sun, 7 Jul 2013 19:54:38 +0200 Subject: Fix parseColor, change remaining colorkeys to new format, fix Contributor list --- src/guiFormSpecMenu.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index 3a3a9433e..994730619 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -662,7 +662,7 @@ void GUIFormSpecMenu::parseTextList(parserData* data,std::string element) { e->addItem(narrow_to_wide(items[i]).c_str() +1); } else { - std::wstring toadd = narrow_to_wide(items[i].c_str() + 4); + std::wstring toadd = narrow_to_wide(items[i].c_str() + 7); std::string color = items[i].substr(1,6); e->addItem(toadd.c_str()); @@ -2519,19 +2519,15 @@ bool GUIFormSpecMenu::OnEvent(const SEvent& event) bool GUIFormSpecMenu::parseColor(std::string color, irr::video::SColor& outcolor) { outcolor = irr::video::SColor(0,0,0,0); - if(color.size() != 6) return false; - if(!string_allowed(color, "0123456789abcdefABCDEF")) return false; + if(!string_allowed(color, "0123456789abcdefABCDEF")) + return false; - unsigned int r, g, b; - std::istringstream iss(""); - iss.str(color.substr(0, 1)); - iss >> std::hex >> r; - iss.str(color.substr(2, 1)); - iss >> std::hex >> g; - iss.str(color.substr(4, 1)); - iss >> std::hex >> b; + u32 color_value; + std::istringstream iss(color); + iss >> std::hex >> color_value; + outcolor = irr::video::SColor(color_value); - outcolor = irr::video::SColor(255,r,g,b); + outcolor.setAlpha(255); return true; } -- cgit v1.2.3