mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-17 20:13:07 +01:00
Make StrDecompToPrecomp() take C++ strings
This commit is contained in:
committed by
GitHub
parent
b939bc2ac4
commit
63ed6c99a5
@@ -709,8 +709,10 @@ static void WindowLoadsavePaint(rct_window* w, rct_drawpixelinfo* dpi)
|
||||
buffer += _shortenedDirectory;
|
||||
|
||||
// Draw path text
|
||||
const auto normalisedPath = Platform::StrDecompToPrecomp(buffer.data());
|
||||
const auto* normalisedPathC = normalisedPath.c_str();
|
||||
auto ft = Formatter();
|
||||
ft.Add<const char*>(Platform::StrDecompToPrecomp(buffer.data()));
|
||||
ft.Add<const char*>(normalisedPathC);
|
||||
DrawTextEllipsised(dpi, { w->windowPos.x + 4, w->windowPos.y + 20 }, w->width - 8, STR_STRING, ft);
|
||||
|
||||
// Name button text
|
||||
|
||||
@@ -2145,8 +2145,10 @@ private:
|
||||
dpi, windowPos + ScreenCoordsXY{ widgets[WIDX_AUTOSAVE_AMOUNT].left + 1, widgets[WIDX_AUTOSAVE_AMOUNT].top + 1 },
|
||||
STR_WINDOW_OBJECTIVE_VALUE_GUEST_COUNT, ft, { colours[1] });
|
||||
|
||||
const auto normalisedPath = Platform::StrDecompToPrecomp(gConfigGeneral.rct1_path);
|
||||
const auto* normalisedPathC = normalisedPath.c_str();
|
||||
ft = Formatter();
|
||||
ft.Add<utf8*>(Platform::StrDecompToPrecomp(gConfigGeneral.rct1_path));
|
||||
ft.Add<const utf8*>(normalisedPathC);
|
||||
|
||||
rct_widget pathWidget = widgets[WIDX_PATH_TO_RCT1_BUTTON];
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace Platform
|
||||
return std::string();
|
||||
}
|
||||
|
||||
utf8* StrDecompToPrecomp(utf8* input)
|
||||
u8string StrDecompToPrecomp(u8string_view input)
|
||||
{
|
||||
return input;
|
||||
return u8string(input);
|
||||
}
|
||||
|
||||
bool HandleSpecialCommandLineArgument(const char* argument)
|
||||
|
||||
@@ -166,9 +166,9 @@ namespace Platform
|
||||
return exePath;
|
||||
}
|
||||
|
||||
utf8* StrDecompToPrecomp(utf8* input)
|
||||
u8string StrDecompToPrecomp(u8string_view input)
|
||||
{
|
||||
return input;
|
||||
return u8string(input);
|
||||
}
|
||||
|
||||
bool HandleSpecialCommandLineArgument(const char* argument)
|
||||
|
||||
@@ -357,9 +357,9 @@ namespace Platform
|
||||
return String::ToUtf8(wExePath.get());
|
||||
}
|
||||
|
||||
utf8* StrDecompToPrecomp(utf8* input)
|
||||
u8string StrDecompToPrecomp(u8string_view input)
|
||||
{
|
||||
return input;
|
||||
return u8string(input);
|
||||
}
|
||||
|
||||
void SetUpFileAssociations()
|
||||
|
||||
@@ -127,17 +127,13 @@ namespace Platform
|
||||
}
|
||||
}
|
||||
|
||||
utf8* StrDecompToPrecomp(utf8* input)
|
||||
u8string StrDecompToPrecomp(u8string_view input)
|
||||
{
|
||||
@autoreleasepool
|
||||
{
|
||||
if (input == NULL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
NSString* inputDecomp = [NSString stringWithUTF8String:input];
|
||||
return strdup([inputDecomp.precomposedStringWithCanonicalMapping cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
auto cppString = u8string(input);
|
||||
NSString* inputDecomp = [NSString stringWithUTF8String:cppString.c_str()];
|
||||
return u8string([inputDecomp.precomposedStringWithCanonicalMapping cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Platform
|
||||
bool IsRunningInWine();
|
||||
bool IsColourTerminalSupported();
|
||||
bool HandleSpecialCommandLineArgument(const char* argument);
|
||||
utf8* StrDecompToPrecomp(utf8* input);
|
||||
u8string StrDecompToPrecomp(u8string_view input);
|
||||
bool RequireNewWindow(bool openGL);
|
||||
} // namespace Platform
|
||||
|
||||
|
||||
Reference in New Issue
Block a user