1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 22:13:07 +01:00

Remove common format formatter where possible (#13034)

* Remove common format formatter where possible

Eventually should have it limited to tooltips, window titles and widget args

* Remove remaining paint functions using common

* Remove misuse of gCommonFormatArgs
This commit is contained in:
Duncan
2020-09-30 22:42:04 +01:00
committed by GitHub
parent e4068b9fa8
commit 2063aea5ef
28 changed files with 341 additions and 277 deletions

View File

@@ -698,7 +698,7 @@ static void window_loadsave_paint(rct_window* w, rct_drawpixelinfo* dpi)
safe_strcpy(ch, _shortenedDirectory, sizeof(buffer) - (ch - buffer));
// Draw path text
auto ft = Formatter::Common();
auto ft = Formatter();
ft.Add<utf8*>(Platform::StrDecompToPrecomp(buffer));
DrawTextEllipsised(dpi, { w->windowPos.x + 4, w->windowPos.y + 20 }, w->width - 8, STR_STRING, ft, COLOUR_BLACK);
@@ -755,13 +755,13 @@ static void window_loadsave_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i
// display a marker next to the currently loaded game file
if (_listItems[i].loaded)
{
auto ft = Formatter::Common();
auto ft = Formatter();
ft.Add<rct_string_id>(STR_RIGHTGUILLEMET);
gfx_draw_string_left(dpi, stringId, gCommonFormatArgs, COLOUR_BLACK, { 0, y });
gfx_draw_string_left(dpi, stringId, ft.Data(), COLOUR_BLACK, { 0, y });
}
// Print filename
auto ft = Formatter::Common();
auto ft = Formatter();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<char*>(_listItems[i].name.c_str());
int32_t max_file_width = w->widgets[WIDX_SORT_NAME].width() - 10;
@@ -770,13 +770,13 @@ static void window_loadsave_scrollpaint(rct_window* w, rct_drawpixelinfo* dpi, i
// Print formatted modified date, if this is a file
if (_listItems[i].type == TYPE_FILE)
{
ft = Formatter::Common();
ft = Formatter();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<char*>(_listItems[i].date_formatted.c_str());
DrawTextEllipsised(
dpi, { dateAnchor - DATE_TIME_GAP, y }, maxDateWidth, stringId, ft, COLOUR_BLACK, TextAlignment::RIGHT);
ft = Formatter::Common();
ft = Formatter();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<char*>(_listItems[i].time_formatted.c_str());
DrawTextEllipsised(dpi, { dateAnchor + DATE_TIME_GAP, y }, maxTimeWidth, stringId, ft, COLOUR_BLACK);
@@ -1197,13 +1197,12 @@ static void window_overwrite_prompt_paint(rct_window* w, rct_drawpixelinfo* dpi)
{
window_draw_widgets(w, dpi);
auto ft = Formatter::Common();
auto ft = Formatter();
ft.Add<rct_string_id>(STR_STRING);
ft.Add<char*>(_window_overwrite_prompt_name);
ScreenCoordsXY stringCoords(w->windowPos.x + w->width / 2, w->windowPos.y + (w->height / 2) - 3);
gfx_draw_string_centred_wrapped(
dpi, gCommonFormatArgs, stringCoords, w->width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, COLOUR_BLACK);
gfx_draw_string_centred_wrapped(dpi, ft.Data(), stringCoords, w->width - 4, STR_FILEBROWSER_OVERWRITE_PROMPT, COLOUR_BLACK);
}
#pragma endregion