mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Format the integers into temporary buffer to fix inline sprites
This commit is contained in:
@@ -593,31 +593,17 @@ namespace OpenRCT2
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case FormatToken::String:
|
case FormatToken::String:
|
||||||
if constexpr (std::is_same<T, const char*>())
|
ss << arg;
|
||||||
{
|
|
||||||
if (arg != nullptr)
|
|
||||||
{
|
|
||||||
ss << arg;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same<T, const std::string&>())
|
|
||||||
{
|
|
||||||
ss << arg.c_str();
|
|
||||||
}
|
|
||||||
else if constexpr (std::is_same<T, std::string>())
|
|
||||||
{
|
|
||||||
ss << arg.c_str();
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case FormatToken::Sprite:
|
case FormatToken::Sprite:
|
||||||
if constexpr (std::is_integral<T>())
|
if constexpr (std::is_integral<T>())
|
||||||
{
|
{
|
||||||
auto idx = static_cast<uint32_t>(arg);
|
auto idx = static_cast<uint32_t>(arg);
|
||||||
ss << "{INLINE_SPRITE}";
|
char inlineBuf[64];
|
||||||
ss << "{" << ((idx >> 0) & 0xFF) << "}";
|
size_t len = snprintf(
|
||||||
ss << "{" << ((idx >> 8) & 0xFF) << "}";
|
inlineBuf, sizeof(inlineBuf), "{INLINE_SPRITE}{%u}{%u}{%u}{%u}", ((idx >> 0) & 0xFF),
|
||||||
ss << "{" << ((idx >> 16) & 0xFF) << "}";
|
((idx >> 8) & 0xFF), ((idx >> 16) & 0xFF), ((idx >> 24) & 0xFF));
|
||||||
ss << "{" << ((idx >> 24) & 0xFF) << "}";
|
ss.append(inlineBuf, len);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user