summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSfan5 <sfan5@live.de>2013-07-07 19:54:38 +0200
committerSfan5 <sfan5@live.de>2013-07-07 19:59:18 +0200
commit7e73b7cae9faf203e369dc5cf2b85cff6e6efbad (patch)
treef14ac5571625588568a694bfe1e99df48e733e7e /src
parentb3001bcd6e041f89db8514bf8603214fba6dd91e (diff)
downloadminetest-7e73b7cae9faf203e369dc5cf2b85cff6e6efbad.tar.gz
minetest-7e73b7cae9faf203e369dc5cf2b85cff6e6efbad.tar.bz2
minetest-7e73b7cae9faf203e369dc5cf2b85cff6e6efbad.zip
Fix parseColor, change remaining colorkeys to new format, fix Contributor list
Diffstat (limited to 'src')
-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;
}