aboutsummaryrefslogtreecommitdiff
path: root/src/guiFormSpecMenu.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/guiFormSpecMenu.cpp')
-rw-r--r--src/guiFormSpecMenu.cpp20
1 files changed, 8 insertions, 12 deletions
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;
}