ensure fitness

pull/3236/head
Kindi 8 months ago
parent 9087de1596
commit 22d685eca3

@ -246,6 +246,7 @@
Task #5896: Do not use deprecated MyGUI properties Task #5896: Do not use deprecated MyGUI properties
Task #6085: Replace boost::filesystem with std::filesystem Task #6085: Replace boost::filesystem with std::filesystem
Task #6149: Dehardcode Lua API_REVISION Task #6149: Dehardcode Lua API_REVISION
Task #6505: UTF-8 support in Lua scripts
Task #6624: Drop support for saves made prior to 0.45 Task #6624: Drop support for saves made prior to 0.45
Task #7048: Get rid of std::bind Task #7048: Get rid of std::bind
Task #7113: Move from std::atoi to std::from_char Task #7113: Move from std::atoi to std::from_char

@ -96,7 +96,7 @@ namespace LuaUtf8
utf8["char"] = [](const sol::variadic_args args) -> std::string { utf8["char"] = [](const sol::variadic_args args) -> std::string {
std::string result{}; std::string result{};
std::wstring_convert<std::codecvt_utf8<wchar_t>> converter; std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> converter;
for (size_t i = 0; i < args.size(); ++i) for (size_t i = 0; i < args.size(); ++i)
{ {
int64_t codepoint = getInteger(args[i], (i + 1), "char"); int64_t codepoint = getInteger(args[i], (i + 1), "char");
@ -104,8 +104,7 @@ namespace LuaUtf8
throw std::runtime_error( throw std::runtime_error(
"bad argument #" + std::to_string(i + 1) + " to 'char' (value out of range)"); "bad argument #" + std::to_string(i + 1) + " to 'char' (value out of range)");
// this feels dodgy if wchar_t is 16-bit as MAXUTF won't fit in sixteen bits result += converter.to_bytes(static_cast<char32_t>(codepoint));
result += converter.to_bytes(static_cast<wchar_t>(codepoint));
} }
return result; return result;
}; };

Loading…
Cancel
Save