1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-11 17:51:04 +00:00

Fix parseColor, change remaining colorkeys to new format, fix Contributor list

This commit is contained in:
Sfan5 2013-07-07 19:54:38 +02:00
parent b3001bcd6e
commit 7e73b7cae9
3 changed files with 15 additions and 19 deletions

View file

@ -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;
}