Fixed MXE builds, 2nd try
parent
f206b49106
commit
d9c8a7ed9b
|
@ -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
|
||||
{
|
||||
|
||||
|
|
|
@ -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, ...);
|
||||
|
||||
|
|
|
@ -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 (...)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue