Fixed MXE builds, 2nd try

master
krzys-h 2015-08-25 12:18:15 +02:00
parent f206b49106
commit d9c8a7ed9b
3 changed files with 17 additions and 4 deletions

View File

@ -25,6 +25,15 @@
#include <vector>
unsigned int StrUtils::HexStringToInt(const std::string& str)
{
std::stringstream ss;
ss << std::hex << str;
unsigned int x;
ss >> x;
return x;
}
namespace
{

View File

@ -59,6 +59,9 @@ T FromString(const std::string &str, bool *ok = nullptr)
return value;
}
//! Converts string of hex characters to int
unsigned int HexStringToInt(const std::string& str);
//! Replacement for sprintf()
std::string Format(const char *fmt, ...);

View File

@ -23,6 +23,7 @@
#include "common/logger.h"
#include "common/make_unique.h"
#include "common/stringutils.h"
#include "common/resources/resourcemanager.h"
@ -259,10 +260,10 @@ Gfx::Color CLevelParserParam::AsColor()
try
{
red = stoul(m_value.substr(1, 2), nullptr, 16);
green = stoul(m_value.substr(3, 2), nullptr, 16);
blue = stoul(m_value.substr(5, 2), nullptr, 16);
alpha = (m_value.length() == 9) ? stoul(m_value.substr(7, 2), nullptr, 16) : 1.0f;
red = StrUtils::HexStringToInt(m_value.substr(1, 2));
green = StrUtils::HexStringToInt(m_value.substr(3, 2));
blue = StrUtils::HexStringToInt(m_value.substr(5, 2));
alpha = (m_value.length() == 9) ? StrUtils::HexStringToInt(m_value.substr(7, 2)) : 1.0f;
}
catch (...)
{