mirror of https://github.com/OpenRCT2/OpenRCT2.git
Merge pull request #12936 from ZehMatt/refactor/formatter
Refactor more text formatting
This commit is contained in:
commit
3b148bf25c
|
@ -179,7 +179,7 @@ void TextComposition::HandleMessage(const SDL_Event* e)
|
|||
if ((modifier & KEYBOARD_PRIMARY_MODIFIER) && _session.Length)
|
||||
{
|
||||
SDL_SetClipboardText(_session.Buffer);
|
||||
context_show_error(STR_COPY_INPUT_TO_CLIPBOARD, STR_NONE);
|
||||
context_show_error(STR_COPY_INPUT_TO_CLIPBOARD, STR_NONE, {});
|
||||
}
|
||||
break;
|
||||
case SDLK_v:
|
||||
|
|
|
@ -206,9 +206,9 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
rct_window* ShowError(rct_string_id title, rct_string_id message) override
|
||||
rct_window* ShowError(rct_string_id title, rct_string_id message, const Formatter& args) override
|
||||
{
|
||||
return window_error_open(title, message);
|
||||
return window_error_open(title, message, args);
|
||||
}
|
||||
|
||||
rct_window* ShowError(const std::string_view& title, const std::string_view& message) override
|
||||
|
|
|
@ -467,10 +467,9 @@ static void widget_groupbox_draw(rct_drawpixelinfo* dpi, rct_window* w, rct_widg
|
|||
colour |= COLOUR_FLAG_INSET;
|
||||
|
||||
utf8 buffer[512] = { 0 };
|
||||
uint8_t args[sizeof(uintptr_t)] = { 0 };
|
||||
format_string(buffer, sizeof(buffer), stringId, formatArgs);
|
||||
Formatter(args).Add<utf8*>(buffer);
|
||||
gfx_draw_string_left(dpi, STR_STRING, args, colour, { l, t });
|
||||
auto ft = Formatter().Add<utf8*>(buffer);
|
||||
gfx_draw_string_left(dpi, STR_STRING, ft.Data(), colour, { l, t });
|
||||
textRight = l + gfx_get_string_width(buffer) + 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -1016,7 +1016,7 @@ static void window_cheats_rides_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
{
|
||||
if (!gCheatsShowAllOperatingModes)
|
||||
{
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE);
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {});
|
||||
}
|
||||
CheatsSet(CheatType::ShowAllOperatingModes, !gCheatsShowAllOperatingModes);
|
||||
}
|
||||
|
@ -1025,7 +1025,7 @@ static void window_cheats_rides_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
{
|
||||
if (!gCheatsShowVehiclesFromOtherTrackTypes)
|
||||
{
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE);
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {});
|
||||
}
|
||||
CheatsSet(CheatType::ShowVehiclesFromOtherTrackTypes, !gCheatsShowVehiclesFromOtherTrackTypes);
|
||||
}
|
||||
|
@ -1034,7 +1034,7 @@ static void window_cheats_rides_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
{
|
||||
if (!gCheatsDisableTrainLengthLimit)
|
||||
{
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE);
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {});
|
||||
}
|
||||
CheatsSet(CheatType::DisableTrainLengthLimit, !gCheatsDisableTrainLengthLimit);
|
||||
}
|
||||
|
@ -1046,7 +1046,7 @@ static void window_cheats_rides_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
{
|
||||
if (!gCheatsAllowArbitraryRideTypeChanges)
|
||||
{
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE);
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {});
|
||||
}
|
||||
CheatsSet(CheatType::AllowArbitraryRideTypeChanges, !gCheatsAllowArbitraryRideTypeChanges);
|
||||
}
|
||||
|
@ -1064,7 +1064,7 @@ static void window_cheats_rides_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
{
|
||||
if (!gCheatsAllowTrackPlaceInvalidHeights)
|
||||
{
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE);
|
||||
context_show_error(STR_WARNING_IN_CAPS, STR_THIS_FEATURE_IS_CURRENTLY_UNSTABLE, {});
|
||||
}
|
||||
CheatsSet(CheatType::AllowTrackPlaceInvalidHeights, !gCheatsAllowTrackPlaceInvalidHeights);
|
||||
}
|
||||
|
|
|
@ -207,7 +207,7 @@ static bool window_editor_bottom_toolbar_check_object_selection()
|
|||
return true;
|
||||
}
|
||||
|
||||
context_show_error(STR_INVALID_SELECTION_OF_OBJECTS, gGameCommandErrorText);
|
||||
context_show_error(STR_INVALID_SELECTION_OF_OBJECTS, gGameCommandErrorText, {});
|
||||
w = window_find_by_class(WC_EDITOR_OBJECT_SELECTION);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -251,7 +251,7 @@ void window_editor_bottom_toolbar_jump_forward_to_invention_list_set_up()
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, gGameCommandErrorText);
|
||||
context_show_error(STR_CANT_ADVANCE_TO_NEXT_EDITOR_STAGE, gGameCommandErrorText, {});
|
||||
}
|
||||
|
||||
gfx_invalidate_screen();
|
||||
|
@ -289,7 +289,7 @@ void window_editor_bottom_toolbar_jump_forward_to_save_scenario()
|
|||
{
|
||||
if (!scenario_prepare_for_save())
|
||||
{
|
||||
context_show_error(STR_UNABLE_TO_SAVE_SCENARIO_FILE, gGameCommandErrorText);
|
||||
context_show_error(STR_UNABLE_TO_SAVE_SCENARIO_FILE, gGameCommandErrorText, {});
|
||||
gfx_invalidate_screen();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -718,7 +718,7 @@ static void window_editor_object_selection_scroll_mousedown(
|
|||
{
|
||||
rct_string_id error_title = (ebx & 1) ? STR_UNABLE_TO_SELECT_THIS_OBJECT : STR_UNABLE_TO_DE_SELECT_THIS_OBJECT;
|
||||
|
||||
context_show_error(error_title, gGameCommandErrorText);
|
||||
context_show_error(error_title, gGameCommandErrorText, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,8 @@ static void window_editor_object_selection_scroll_mousedown(
|
|||
|
||||
if (_maxObjectsWasHit)
|
||||
{
|
||||
context_show_error(STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED);
|
||||
context_show_error(
|
||||
STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -497,7 +497,7 @@ static void window_editor_objective_options_arg_1_increase(rct_window* w)
|
|||
case OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE:
|
||||
if (gScenarioObjective.Currency >= MONEY(2000000, 00))
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -508,7 +508,7 @@ static void window_editor_objective_options_arg_1_increase(rct_window* w)
|
|||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (gScenarioObjective.Currency >= MONEY(2000000, 00))
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -519,7 +519,7 @@ static void window_editor_objective_options_arg_1_increase(rct_window* w)
|
|||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (gScenarioObjective.MinimumLength >= 5000)
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -530,7 +530,7 @@ static void window_editor_objective_options_arg_1_increase(rct_window* w)
|
|||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (gScenarioObjective.MinimumExcitement >= FIXED_2DP(9, 90))
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -541,7 +541,7 @@ static void window_editor_objective_options_arg_1_increase(rct_window* w)
|
|||
default:
|
||||
if (gScenarioObjective.NumGuests >= 5000)
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -561,7 +561,7 @@ static void window_editor_objective_options_arg_1_decrease(rct_window* w)
|
|||
case OBJECTIVE_REPLAY_LOAN_AND_PARK_VALUE:
|
||||
if (gScenarioObjective.Currency <= MONEY(1000, 00))
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -572,7 +572,7 @@ static void window_editor_objective_options_arg_1_decrease(rct_window* w)
|
|||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (gScenarioObjective.Currency <= MONEY(1000, 00))
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -583,7 +583,7 @@ static void window_editor_objective_options_arg_1_decrease(rct_window* w)
|
|||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (gScenarioObjective.MinimumLength <= 1000)
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -594,7 +594,7 @@ static void window_editor_objective_options_arg_1_decrease(rct_window* w)
|
|||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (gScenarioObjective.MinimumExcitement <= FIXED_2DP(4, 00))
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -605,7 +605,7 @@ static void window_editor_objective_options_arg_1_decrease(rct_window* w)
|
|||
default:
|
||||
if (gScenarioObjective.NumGuests <= 250)
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -620,7 +620,7 @@ static void window_editor_objective_options_arg_2_increase(rct_window* w)
|
|||
{
|
||||
if (gScenarioObjective.Year >= 25)
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -633,7 +633,7 @@ static void window_editor_objective_options_arg_2_decrease(rct_window* w)
|
|||
{
|
||||
if (gScenarioObjective.Year <= 1)
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1139,11 +1139,10 @@ static void window_editor_objective_options_rides_scrollpaint(rct_window* w, rct
|
|||
}
|
||||
|
||||
// Ride name
|
||||
uint8_t args[32]{};
|
||||
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
gfx_draw_string_left(dpi, stringId, args, COLOUR_BLACK, { 15, y });
|
||||
gfx_draw_string_left(dpi, stringId, ft.Data(), COLOUR_BLACK, { 15, y });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -568,7 +568,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_CASH, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_CASH, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -581,7 +581,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_CASH, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_CASH, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -594,7 +594,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_INIT_LOAN, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_INIT_LOAN, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -607,7 +607,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_INIT_LOAN, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_INIT_LOAN, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -620,7 +620,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_MAX_LOAN, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_MAX_LOAN, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -633,7 +633,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_MAX_LOAN, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_MAX_LOAN, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -646,7 +646,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -659,7 +659,7 @@ static void window_editor_scenario_options_financial_mousedown(rct_window* w, rc
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -852,7 +852,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -865,7 +865,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -878,7 +878,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -891,7 +891,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -904,7 +904,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -917,7 +917,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -930,7 +930,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -943,7 +943,7 @@ static void window_editor_scenario_options_guests_mousedown(rct_window* w, rct_w
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -1157,7 +1157,7 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -1170,7 +1170,7 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -1183,7 +1183,7 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -1196,7 +1196,7 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -1209,7 +1209,7 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
@ -1222,7 +1222,7 @@ static void window_editor_scenario_options_park_mousedown(rct_window* w, rct_wid
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
|
|
@ -72,10 +72,10 @@ static uint16_t _window_error_num_lines;
|
|||
* bx: title
|
||||
* dx: message
|
||||
*/
|
||||
rct_window* window_error_open(rct_string_id title, rct_string_id message)
|
||||
rct_window* window_error_open(rct_string_id title, rct_string_id message, const Formatter& args)
|
||||
{
|
||||
auto titlez = format_string(title, gCommonFormatArgs);
|
||||
auto messagez = format_string(message, gCommonFormatArgs);
|
||||
auto titlez = format_string(title, args.Data());
|
||||
auto messagez = format_string(message, args.Data());
|
||||
return window_error_open(titlez, messagez);
|
||||
}
|
||||
|
||||
|
|
|
@ -1989,7 +1989,7 @@ void window_guest_thoughts_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto ft = Formatter::Common();
|
||||
peep_thought_set_format_args(thought, ft);
|
||||
screenCoords.y += gfx_draw_string_left_wrapped(
|
||||
dpi, const_cast<unsigned char*>(ft.GetStartBuf()), screenCoords, width, STR_BLACK_STRING, COLOUR_BLACK);
|
||||
dpi, const_cast<unsigned char*>(ft.Data()), screenCoords, width, STR_BLACK_STRING, COLOUR_BLACK);
|
||||
|
||||
// If this is the last visible line end drawing.
|
||||
if (screenCoords.y > w->windowPos.y + window_guest_thoughts_widgets[WIDX_PAGE_BACKGROUND].bottom - 32)
|
||||
|
|
|
@ -1066,11 +1066,10 @@ static bool guest_should_be_visible(Peep* peep)
|
|||
if (_window_guest_list_filter_name[0] != '\0')
|
||||
{
|
||||
char name[256]{};
|
||||
uint8_t args[32]{};
|
||||
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
peep->FormatNameTo(ft);
|
||||
format_string(name, sizeof(name), STR_STRINGID, args);
|
||||
format_string(name, sizeof(name), STR_STRINGID, ft.Data());
|
||||
if (strcasestr(name, _window_guest_list_filter_name) == nullptr)
|
||||
{
|
||||
return false;
|
||||
|
|
|
@ -106,7 +106,7 @@ rct_window* window_install_track_open(const utf8* path)
|
|||
_trackDesign = track_design_open(path);
|
||||
if (_trackDesign == nullptr)
|
||||
{
|
||||
context_show_error(STR_UNABLE_TO_LOAD_FILE, STR_NONE);
|
||||
context_show_error(STR_UNABLE_TO_LOAD_FILE, STR_NONE, {});
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -416,7 +416,7 @@ static void window_install_track_design(rct_window* w)
|
|||
if (!platform_ensure_directory_exists(destPath))
|
||||
{
|
||||
log_error("Unable to create directory '%s'", destPath);
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE);
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -426,7 +426,7 @@ static void window_install_track_design(rct_window* w)
|
|||
if (Platform::FileExists(destPath))
|
||||
{
|
||||
log_info("%s already exists, prompting user for a different track design name", destPath);
|
||||
context_show_error(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE);
|
||||
context_show_error(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE, {});
|
||||
window_text_input_raw_open(
|
||||
w, WIDX_INSTALL, STR_SELECT_NEW_NAME_FOR_TRACK_DESIGN, STR_AN_EXISTING_TRACK_DESIGN_ALREADY_HAS_THIS_NAME,
|
||||
_trackName.c_str(), 255);
|
||||
|
@ -439,7 +439,7 @@ static void window_install_track_design(rct_window* w)
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE);
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -589,7 +589,7 @@ static void window_loadsave_textinput(rct_window* w, rct_widgetindex widgetIndex
|
|||
case WIDX_NEW_FOLDER:
|
||||
if (!filename_valid_characters(text))
|
||||
{
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE);
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -598,7 +598,7 @@ static void window_loadsave_textinput(rct_window* w, rct_widgetindex widgetIndex
|
|||
|
||||
if (!platform_ensure_directory_exists(path))
|
||||
{
|
||||
context_show_error(STR_UNABLE_TO_CREATE_FOLDER, STR_NONE);
|
||||
context_show_error(STR_UNABLE_TO_CREATE_FOLDER, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -998,7 +998,7 @@ static void window_loadsave_select(rct_window* w, const char* path)
|
|||
{
|
||||
if (!is_valid_path(path))
|
||||
{
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE);
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1029,7 +1029,7 @@ static void window_loadsave_select(rct_window* w, const char* path)
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_SAVE_GAME, STR_GAME_SAVE_FAILED);
|
||||
context_show_error(STR_SAVE_GAME, STR_GAME_SAVE_FAILED, {});
|
||||
window_loadsave_invoke_callback(MODAL_RESULT_FAIL, pathBuffer);
|
||||
}
|
||||
break;
|
||||
|
@ -1045,7 +1045,7 @@ static void window_loadsave_select(rct_window* w, const char* path)
|
|||
else
|
||||
{
|
||||
// Not the best message...
|
||||
context_show_error(STR_LOAD_LANDSCAPE, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA);
|
||||
context_show_error(STR_LOAD_LANDSCAPE, STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, {});
|
||||
window_loadsave_invoke_callback(MODAL_RESULT_FAIL, pathBuffer);
|
||||
}
|
||||
break;
|
||||
|
@ -1062,7 +1062,7 @@ static void window_loadsave_select(rct_window* w, const char* path)
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_SAVE_LANDSCAPE, STR_LANDSCAPE_SAVE_FAILED);
|
||||
context_show_error(STR_SAVE_LANDSCAPE, STR_LANDSCAPE_SAVE_FAILED, {});
|
||||
window_loadsave_invoke_callback(MODAL_RESULT_FAIL, pathBuffer);
|
||||
}
|
||||
break;
|
||||
|
@ -1085,7 +1085,7 @@ static void window_loadsave_select(rct_window* w, const char* path)
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED);
|
||||
context_show_error(STR_FILE_DIALOG_TITLE_SAVE_SCENARIO, STR_SCENARIO_SAVE_FAILED, {});
|
||||
gS6Info.editor_step = EDITOR_STEP_OBJECTIVE_SELECTION;
|
||||
window_loadsave_invoke_callback(MODAL_RESULT_FAIL, pathBuffer);
|
||||
}
|
||||
|
@ -1121,7 +1121,7 @@ static void window_loadsave_select(rct_window* w, const char* path)
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_FILE_DIALOG_TITLE_SAVE_TRACK, STR_TRACK_SAVE_FAILED);
|
||||
context_show_error(STR_FILE_DIALOG_TITLE_SAVE_TRACK, STR_TRACK_SAVE_FAILED, {});
|
||||
window_loadsave_invoke_callback(MODAL_RESULT_FAIL, path);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -1341,7 +1341,7 @@ static void map_window_increase_map_size()
|
|||
{
|
||||
if (gMapSize >= MAXIMUM_MAP_SIZE_TECHNICAL)
|
||||
{
|
||||
context_show_error(STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ static void map_window_decrease_map_size()
|
|||
{
|
||||
if (gMapSize < 16)
|
||||
{
|
||||
context_show_error(STR_CANT_DECREASE_MAP_SIZE_ANY_FURTHER, STR_NONE);
|
||||
context_show_error(STR_CANT_DECREASE_MAP_SIZE_ANY_FURTHER, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,14 +111,13 @@ private:
|
|||
else
|
||||
{
|
||||
char str_downloading_objects[256]{};
|
||||
uint8_t args[32]{};
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
if (_downloadStatusInfo.Source.empty())
|
||||
{
|
||||
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
|
||||
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
|
||||
ft.Add<char*>(_downloadStatusInfo.Name.c_str());
|
||||
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, args);
|
||||
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS, ft.Data());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -126,7 +125,8 @@ private:
|
|||
ft.Add<char*>(_downloadStatusInfo.Source.c_str());
|
||||
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Count));
|
||||
ft.Add<int16_t>(static_cast<int16_t>(_downloadStatusInfo.Total));
|
||||
format_string(str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, args);
|
||||
format_string(
|
||||
str_downloading_objects, sizeof(str_downloading_objects), STR_DOWNLOADING_OBJECTS_FROM, ft.Data());
|
||||
}
|
||||
|
||||
auto intent = Intent(WC_NETWORK_STATUS);
|
||||
|
|
|
@ -934,24 +934,24 @@ static void window_options_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
|||
gConfigGeneral.rct1_path = rct1path;
|
||||
gConfigInterface.scenarioselect_last_tab = 0;
|
||||
config_save_default();
|
||||
context_show_error(STR_RESTART_REQUIRED, STR_NONE);
|
||||
context_show_error(STR_RESTART_REQUIRED, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeFree(rct1path);
|
||||
context_show_error(STR_PATH_TO_RCT1_IS_WRONG_VERSION, STR_NONE);
|
||||
context_show_error(STR_PATH_TO_RCT1_IS_WRONG_VERSION, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeFree(rct1path);
|
||||
context_show_error(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, STR_NONE);
|
||||
context_show_error(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
SafeFree(rct1path);
|
||||
context_show_error(STR_PATH_TO_RCT1_WRONG_ERROR, STR_NONE);
|
||||
context_show_error(STR_PATH_TO_RCT1_WRONG_ERROR, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
w->Invalidate();
|
||||
|
@ -1440,7 +1440,7 @@ static void window_options_dropdown(rct_window* w, rct_widgetindex widgetIndex,
|
|||
if (language_open(fallbackLanguage))
|
||||
{
|
||||
// It worked, so we can say it with error message in-game
|
||||
context_show_error(STR_LANGUAGE_LOAD_FAILED, STR_NONE);
|
||||
context_show_error(STR_LANGUAGE_LOAD_FAILED, STR_NONE, {});
|
||||
}
|
||||
// report error to console regardless
|
||||
log_error("Failed to open language file.");
|
||||
|
@ -1494,7 +1494,8 @@ static void window_options_dropdown(rct_window* w, rct_widgetindex widgetIndex,
|
|||
if ((dropdownIndex == 1 || dropdownIndex == 3)
|
||||
&& !Platform::FileExists(context_get_path_legacy(PATH_ID_CSS50)))
|
||||
{
|
||||
context_show_error(STR_OPTIONS_MUSIC_ERR_CSS50_NOT_FOUND, STR_OPTIONS_MUSIC_ERR_CSS50_NOT_FOUND_HINT);
|
||||
context_show_error(
|
||||
STR_OPTIONS_MUSIC_ERR_CSS50_NOT_FOUND, STR_OPTIONS_MUSIC_ERR_CSS50_NOT_FOUND_HINT, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -3842,7 +3842,7 @@ static void window_ride_locate_mechanic(rct_window* w)
|
|||
mechanic = ride_find_closest_mechanic(ride, 1);
|
||||
|
||||
if (mechanic == nullptr)
|
||||
context_show_error(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE);
|
||||
context_show_error(STR_UNABLE_TO_LOCATE_MECHANIC, STR_NONE, {});
|
||||
else
|
||||
{
|
||||
auto intent = Intent(WC_PEEP);
|
||||
|
@ -3976,7 +3976,7 @@ static void window_ride_maintenance_mousedown(rct_window* w, rct_widgetindex wid
|
|||
}
|
||||
if (num_items == 1)
|
||||
{
|
||||
context_show_error(STR_DEBUG_NO_BREAKDOWNS_AVAILABLE, STR_NONE);
|
||||
context_show_error(STR_DEBUG_NO_BREAKDOWNS_AVAILABLE, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4088,11 +4088,11 @@ static void window_ride_maintenance_dropdown(rct_window* w, rct_widgetindex widg
|
|||
if (ride->lifecycle_flags
|
||||
& (RIDE_LIFECYCLE_BREAKDOWN_PENDING | RIDE_LIFECYCLE_BROKEN_DOWN | RIDE_LIFECYCLE_CRASHED))
|
||||
{
|
||||
context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_ALREADY_BROKEN);
|
||||
context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_ALREADY_BROKEN, {});
|
||||
}
|
||||
else if (ride->status == RIDE_STATUS_CLOSED)
|
||||
{
|
||||
context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED);
|
||||
context_show_error(STR_DEBUG_CANT_FORCE_BREAKDOWN, STR_DEBUG_RIDE_IS_CLOSED, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5393,7 +5393,7 @@ static void window_ride_measurements_design_save(rct_window* w)
|
|||
auto errMessage = _trackDesign->CreateTrackDesignScenery();
|
||||
if (errMessage != STR_NONE)
|
||||
{
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, errMessage);
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, errMessage, {});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -607,7 +607,7 @@ static void window_scenery_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_DO_THIS, STR_PERMISSION_DENIED);
|
||||
context_show_error(STR_CANT_DO_THIS, STR_PERMISSION_DENIED, {});
|
||||
}
|
||||
w->Invalidate();
|
||||
break;
|
||||
|
|
|
@ -196,9 +196,9 @@ static void window_server_list_mouseup(rct_window* w, rct_widgetindex widgetInde
|
|||
}
|
||||
else
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ft.Add<const char*>(server.Version.c_str());
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION);
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -235,9 +235,9 @@ static void window_server_list_dropdown(rct_window* w, rct_widgetindex widgetInd
|
|||
}
|
||||
else
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ft.Add<const char*>(server.Version.c_str());
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION);
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_MULTIPLAYER_INCORRECT_SOFTWARE_VERSION, ft);
|
||||
}
|
||||
break;
|
||||
case DDIDX_FAVOURITE:
|
||||
|
@ -553,7 +553,7 @@ static void join_server(std::string address)
|
|||
|
||||
if (!network_begin_client(address.c_str(), port))
|
||||
{
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE);
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -415,8 +415,8 @@ static void window_staff_list_tooldown(rct_window* w, rct_widgetindex widgetInde
|
|||
}
|
||||
else
|
||||
{
|
||||
Formatter::Common().Add<rct_string_id>(StaffNamingConvention[selectedPeepType].plural);
|
||||
context_show_error(STR_NO_THING_IN_PARK_YET, STR_NONE);
|
||||
auto ft = Formatter().Add<rct_string_id>(StaffNamingConvention[selectedPeepType].plural);
|
||||
context_show_error(STR_NO_THING_IN_PARK_YET, STR_NONE, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -378,7 +378,7 @@ static void window_themes_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
|||
case WIDX_THEMES_DELETE_BUTTON:
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ static void window_themes_mouseup(rct_window* w, rct_widgetindex widgetIndex)
|
|||
case WIDX_THEMES_RENAME_BUTTON:
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -535,7 +535,7 @@ static void window_themes_mousedown(rct_window* w, rct_widgetindex widgetIndex,
|
|||
case WIDX_THEMES_RCT1_RIDE_LIGHTS:
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -547,7 +547,7 @@ static void window_themes_mousedown(rct_window* w, rct_widgetindex widgetIndex,
|
|||
case WIDX_THEMES_RCT1_PARK_LIGHTS:
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -559,7 +559,7 @@ static void window_themes_mousedown(rct_window* w, rct_widgetindex widgetIndex,
|
|||
case WIDX_THEMES_RCT1_SCENARIO_FONT:
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -571,7 +571,7 @@ static void window_themes_mousedown(rct_window* w, rct_widgetindex widgetIndex,
|
|||
case WIDX_THEMES_RCT1_BOTTOM_TOOLBAR:
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -654,7 +654,7 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, const Scr
|
|||
{
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -681,7 +681,7 @@ void window_themes_scrollmousedown(rct_window* w, int32_t scrollIndex, const Scr
|
|||
{
|
||||
if (theme_get_flags() & UITHEME_FLAG_PREDEFINED)
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME);
|
||||
context_show_error(STR_THEMES_ERR_CANT_CHANGE_THIS_THEME, STR_THEMES_DESC_CANT_CHANGE_THIS_THEME, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -732,12 +732,12 @@ static void window_themes_textinput(rct_window* w, rct_widgetindex widgetIndex,
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_THEMES_ERR_NAME_ALREADY_EXISTS, STR_NONE);
|
||||
context_show_error(STR_THEMES_ERR_NAME_ALREADY_EXISTS, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE);
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2085,11 +2085,10 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto banner = tileElement->AsWall()->GetBanner();
|
||||
if (banner != nullptr && !banner->IsNull())
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
banner->FormatTextTo(ft);
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, args, COLOUR_WHITE,
|
||||
dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft.Data(), COLOUR_WHITE,
|
||||
screenCoords + ScreenCoordsXY{ 0, 11 });
|
||||
}
|
||||
}
|
||||
|
@ -2152,11 +2151,10 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto banner = sceneryElement->GetBanner();
|
||||
if (banner != nullptr && !banner->IsNull())
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
banner->FormatTextTo(ft);
|
||||
gfx_draw_string_left(
|
||||
dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, args, COLOUR_WHITE,
|
||||
dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft.Data(), COLOUR_WHITE,
|
||||
screenCoords + ScreenCoordsXY{ 0, 22 });
|
||||
}
|
||||
}
|
||||
|
@ -2186,10 +2184,9 @@ static void window_tile_inspector_paint(rct_window* w, rct_drawpixelinfo* dpi)
|
|||
auto banner = tileElement->AsBanner()->GetBanner();
|
||||
if (banner != nullptr && !banner->IsNull())
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
banner->FormatTextTo(ft);
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, args, COLOUR_WHITE, screenCoords);
|
||||
gfx_draw_string_left(dpi, STR_TILE_INSPECTOR_ENTRY_BANNER_TEXT, ft.Data(), COLOUR_WHITE, screenCoords);
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
|
|
@ -619,8 +619,7 @@ static void window_title_command_editor_tool_down(
|
|||
if (peep != nullptr)
|
||||
{
|
||||
validSprite = true;
|
||||
uint8_t formatArgs[32]{};
|
||||
Formatter ft(formatArgs);
|
||||
Formatter ft;
|
||||
peep->FormatNameTo(ft);
|
||||
format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, &peep->Id);
|
||||
}
|
||||
|
@ -631,10 +630,9 @@ static void window_title_command_editor_tool_down(
|
|||
auto ride = vehicle->GetRide();
|
||||
if (ride != nullptr)
|
||||
{
|
||||
uint8_t formatArgs[32]{};
|
||||
Formatter ft(formatArgs);
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, formatArgs);
|
||||
format_string(command.SpriteName, USER_STRING_MAX_LENGTH, STR_STRINGID, ft.Data());
|
||||
}
|
||||
}
|
||||
else if (litter != nullptr)
|
||||
|
|
|
@ -380,7 +380,7 @@ static void window_title_editor_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
}
|
||||
catch (const std::exception&)
|
||||
{
|
||||
context_show_error(ERROR_TYPE_FILE_LOAD, STR_FILE_CONTAINS_INVALID_DATA);
|
||||
context_show_error(ERROR_TYPE_FILE_LOAD, STR_FILE_CONTAINS_INVALID_DATA, {});
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -491,7 +491,7 @@ static void window_title_editor_mouseup(rct_window* w, rct_widgetindex widgetInd
|
|||
{
|
||||
if (!title_preview_sequence(_selectedTitleSequence))
|
||||
{
|
||||
context_show_error(STR_ERR_FAILED_TO_LOAD_TITLE_SEQUENCE, STR_NONE);
|
||||
context_show_error(STR_ERR_FAILED_TO_LOAD_TITLE_SEQUENCE, STR_NONE, {});
|
||||
}
|
||||
else if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
{
|
||||
|
@ -547,7 +547,7 @@ static void window_title_editor_mousedown(rct_window* w, rct_widgetindex widgetI
|
|||
case WIDX_TITLE_EDITOR_PRESETS_DROPDOWN:
|
||||
if (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr)
|
||||
{
|
||||
context_show_error(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE);
|
||||
context_show_error(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -697,17 +697,17 @@ static void window_title_editor_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_ERROR_RESERVED_NAME, STR_NONE);
|
||||
context_show_error(STR_ERROR_RESERVED_NAME, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_ERROR_EXISTING_NAME, STR_NONE);
|
||||
context_show_error(STR_ERROR_EXISTING_NAME, STR_NONE, {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE);
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
}
|
||||
break;
|
||||
case WIDX_TITLE_EDITOR_RENAME_SAVE:
|
||||
|
@ -1076,7 +1076,7 @@ static void window_title_editor_load_sequence(size_t index)
|
|||
TitleSequence* titleSequence = LoadTitleSequence(path);
|
||||
if (titleSequence == nullptr)
|
||||
{
|
||||
context_show_error(STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, STR_NONE);
|
||||
context_show_error(STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1100,11 +1100,11 @@ static bool window_title_editor_check_can_edit()
|
|||
bool commandEditorOpen = (window_find_by_class(WC_TITLE_COMMAND_EDITOR) != nullptr);
|
||||
|
||||
if (_isSequenceReadOnly)
|
||||
context_show_error(STR_ERROR_CANT_CHANGE_TITLE_SEQUENCE, STR_NONE);
|
||||
context_show_error(STR_ERROR_CANT_CHANGE_TITLE_SEQUENCE, STR_NONE, {});
|
||||
else if (title_is_previewing_sequence())
|
||||
context_show_error(STR_TITLE_EDITOR_ERR_CANT_EDIT_WHILE_PLAYING, STR_TITLE_EDITOR_PRESS_STOP_TO_CONTINUE_EDITING);
|
||||
context_show_error(STR_TITLE_EDITOR_ERR_CANT_EDIT_WHILE_PLAYING, STR_TITLE_EDITOR_PRESS_STOP_TO_CONTINUE_EDITING, {});
|
||||
else if (commandEditorOpen)
|
||||
context_show_error(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE);
|
||||
context_show_error(STR_TITLE_EDITOR_ERR_CANT_CHANGE_WHILE_EDITOR_IS_OPEN, STR_NONE, {});
|
||||
else
|
||||
return true;
|
||||
|
||||
|
@ -1149,7 +1149,7 @@ static void window_title_editor_rename_park(size_t index, const utf8* name)
|
|||
{
|
||||
if (!filename_valid_characters(name))
|
||||
{
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE);
|
||||
context_show_error(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1160,7 +1160,7 @@ static void window_title_editor_rename_park(size_t index, const utf8* name)
|
|||
const utf8* savePath = _editingTitleSequence->Saves[i];
|
||||
if (_strcmpi(savePath, name) == 0)
|
||||
{
|
||||
context_show_error(STR_ERROR_EXISTING_NAME, STR_NONE);
|
||||
context_show_error(STR_ERROR_EXISTING_NAME, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -429,7 +429,7 @@ static void window_top_toolbar_mouseup(rct_window* w, rct_widgetindex widgetInde
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CHAT_UNAVAILABLE, STR_NONE);
|
||||
context_show_error(STR_CHAT_UNAVAILABLE, STR_NONE, {});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -2013,7 +2013,7 @@ static void window_top_toolbar_scenery_tool_down(const ScreenCoordsXY& windowPos
|
|||
auto bannerIndex = create_new_banner(0);
|
||||
if (bannerIndex == BANNER_INDEX_NULL)
|
||||
{
|
||||
context_show_error(STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME);
|
||||
context_show_error(STR_CANT_POSITION_THIS_HERE, STR_TOO_MANY_BANNERS_IN_GAME, {});
|
||||
break;
|
||||
}
|
||||
auto bannerPlaceAction = BannerPlaceAction(loc, selectedScenery, bannerIndex, primaryColour);
|
||||
|
|
|
@ -205,13 +205,13 @@ static void window_track_manage_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
|
||||
if (str_is_null_or_empty(text))
|
||||
{
|
||||
context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_NONE);
|
||||
context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_NONE, {});
|
||||
return;
|
||||
}
|
||||
|
||||
if (!filename_valid_characters(text))
|
||||
{
|
||||
context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS);
|
||||
context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_NEW_NAME_CONTAINS_INVALID_CHARACTERS, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -223,7 +223,7 @@ static void window_track_manage_textinput(rct_window* w, rct_widgetindex widgetI
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED);
|
||||
context_show_error(STR_CANT_RENAME_TRACK_DESIGN, STR_ANOTHER_FILE_EXISTS_WITH_NAME_OR_FILE_IS_WRITE_PROTECTED, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ static void window_track_delete_prompt_mouseup(rct_window* w, rct_widgetindex wi
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED);
|
||||
context_show_error(STR_CANT_DELETE_TRACK_DESIGN, STR_FILE_IS_WRITE_PROTECTED_OR_LOCKED, {});
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ static void window_track_list_select(rct_window* w, int32_t listIndex)
|
|||
// Displays a message if the ride can't load, fix #4080
|
||||
if (_loadedTrackDesign == nullptr)
|
||||
{
|
||||
context_show_error(STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TRACK_LOAD_FAILED_ERROR);
|
||||
context_show_error(STR_CANT_BUILD_PARK_ENTRANCE_HERE, STR_TRACK_LOAD_FAILED_ERROR, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ static void window_track_list_select(rct_window* w, int32_t listIndex)
|
|||
if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED
|
||||
&& (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE))
|
||||
{
|
||||
context_show_error(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE);
|
||||
context_show_error(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE, {});
|
||||
}
|
||||
|
||||
auto intent = Intent(WC_TRACK_DESIGN_PLACE);
|
||||
|
|
|
@ -107,7 +107,7 @@ void window_title_editor_open(int32_t tab);
|
|||
void window_title_command_editor_open(struct TitleSequence* sequence, int32_t command, bool insert);
|
||||
rct_window* window_scenarioselect_open(scenarioselect_callback callback, bool titleEditor);
|
||||
|
||||
rct_window* window_error_open(rct_string_id title, rct_string_id message);
|
||||
rct_window* window_error_open(rct_string_id title, rct_string_id message, const class Formatter& formatter);
|
||||
rct_window* window_error_open(const std::string_view& title, const std::string_view& message);
|
||||
struct TrackDesign;
|
||||
rct_window* window_loadsave_open(int32_t type, const char* defaultName, loadsave_callback callback, TrackDesign* t6Exporter);
|
||||
|
|
|
@ -573,7 +573,7 @@ namespace OpenRCT2
|
|||
title_load();
|
||||
}
|
||||
auto windowManager = _uiContext->GetWindowManager();
|
||||
windowManager->ShowError(STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, STR_NONE);
|
||||
windowManager->ShowError(STR_FAILED_TO_LOAD_FILE_CONTAINS_INVALID_DATA, STR_NONE, {});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -672,8 +672,8 @@ namespace OpenRCT2
|
|||
catch (const UnsupportedRCTCFlagException& e)
|
||||
{
|
||||
auto windowManager = _uiContext->GetWindowManager();
|
||||
Formatter::Common().Add<uint16_t>(e.Flag);
|
||||
windowManager->ShowError(STR_FAILED_TO_LOAD_IMCOMPATIBLE_RCTC_FLAG, STR_NONE);
|
||||
auto ft = Formatter().Add<uint16_t>(e.Flag);
|
||||
windowManager->ShowError(STR_FAILED_TO_LOAD_IMCOMPATIBLE_RCTC_FLAG, STR_NONE, ft);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
|
@ -1369,10 +1369,10 @@ void context_force_close_window_by_class(rct_windowclass windowClass)
|
|||
windowManager->ForceClose(windowClass);
|
||||
}
|
||||
|
||||
rct_window* context_show_error(rct_string_id title, rct_string_id message)
|
||||
rct_window* context_show_error(rct_string_id title, rct_string_id message, const Formatter& args)
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
return windowManager->ShowError(title, message);
|
||||
return windowManager->ShowError(title, message, args);
|
||||
}
|
||||
|
||||
void context_update_map_tooltip()
|
||||
|
|
|
@ -252,7 +252,7 @@ void context_set_cursor_trap(bool value);
|
|||
rct_window* context_open_window(rct_windowclass wc);
|
||||
rct_window* context_open_detail_window(uint8_t type, int32_t id);
|
||||
rct_window* context_open_window_view(uint8_t view);
|
||||
rct_window* context_show_error(rct_string_id title, rct_string_id message);
|
||||
rct_window* context_show_error(rct_string_id title, rct_string_id message, const class Formatter& args);
|
||||
rct_window* context_open_intent(Intent* intent);
|
||||
void context_broadcast_intent(Intent* intent);
|
||||
void context_force_close_window_by_class(rct_windowclass wc);
|
||||
|
|
|
@ -128,19 +128,18 @@ void DrawTextBasic(
|
|||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, rct_string_id format, const Formatter& ft, colour_t colour,
|
||||
TextAlignment alignment, bool underline)
|
||||
{
|
||||
return DrawTextBasic(dpi, coords, format, ft.GetStartBuf(), colour, alignment, underline);
|
||||
return DrawTextBasic(dpi, coords, format, ft.Data(), colour, alignment, underline);
|
||||
}
|
||||
|
||||
void DrawTextEllipsised(
|
||||
rct_drawpixelinfo* dpi, const ScreenCoordsXY& coords, int32_t width, rct_string_id format, const Formatter& ft,
|
||||
colour_t colour, TextAlignment alignment, bool underline)
|
||||
{
|
||||
const void* args = ft.GetStartBuf();
|
||||
TextPaint textPaint = { colour, FONT_SPRITE_BASE_MEDIUM, underline, alignment };
|
||||
gCurrentFontSpriteBase = FONT_SPRITE_BASE_MEDIUM;
|
||||
|
||||
utf8 buffer[512];
|
||||
format_string(buffer, sizeof(buffer), format, args);
|
||||
format_string(buffer, sizeof(buffer), format, ft.Data());
|
||||
gfx_clip_string(buffer, width);
|
||||
|
||||
DrawText(dpi, coords, textPaint, buffer);
|
||||
|
|
|
@ -84,7 +84,7 @@ void screenshot_check()
|
|||
}
|
||||
else
|
||||
{
|
||||
context_show_error(STR_SCREENSHOT_FAILED, STR_NONE);
|
||||
context_show_error(STR_SCREENSHOT_FAILED, STR_NONE, {});
|
||||
}
|
||||
|
||||
// redraw_weather();
|
||||
|
@ -414,15 +414,15 @@ void screenshot_giant()
|
|||
WriteDpiToFile(path->c_str(), &dpi, gPalette);
|
||||
|
||||
// Show user that screenshot saved successfully
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ft.Add<rct_string_id>(STR_STRING);
|
||||
ft.Add<char*>(path_get_filename(path->c_str()));
|
||||
context_show_error(STR_SCREENSHOT_SAVED_AS, STR_NONE);
|
||||
context_show_error(STR_SCREENSHOT_SAVED_AS, STR_NONE, ft);
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
log_error("%s", e.what());
|
||||
context_show_error(STR_SCREENSHOT_FAILED, STR_NONE);
|
||||
context_show_error(STR_SCREENSHOT_FAILED, STR_NONE, {});
|
||||
}
|
||||
|
||||
ReleaseDPI(dpi);
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "Language.h"
|
||||
#include "StringIds.h"
|
||||
|
||||
#include <array>
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
|
@ -82,8 +83,9 @@ extern const rct_string_id DateGameShortMonthNames[MONTH_COUNT];
|
|||
|
||||
class Formatter
|
||||
{
|
||||
const uint8_t* StartBuf;
|
||||
uint8_t* CurrentBuf;
|
||||
std::array<uint8_t, 80> Buffer{};
|
||||
uint8_t* StartBuf{};
|
||||
uint8_t* CurrentBuf{};
|
||||
|
||||
public:
|
||||
explicit Formatter(uint8_t* buf)
|
||||
|
@ -92,14 +94,21 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
Formatter()
|
||||
: Buffer{}
|
||||
, StartBuf(Buffer.data())
|
||||
, CurrentBuf(StartBuf)
|
||||
{
|
||||
}
|
||||
|
||||
static Formatter Common()
|
||||
{
|
||||
return Formatter(gCommonFormatArgs);
|
||||
return Formatter{ gCommonFormatArgs };
|
||||
}
|
||||
|
||||
static Formatter MapTooltip()
|
||||
{
|
||||
return Formatter(gMapTooltipFormatArgs);
|
||||
return Formatter{ gMapTooltipFormatArgs };
|
||||
}
|
||||
|
||||
auto Buf()
|
||||
|
@ -107,7 +116,7 @@ public:
|
|||
return CurrentBuf;
|
||||
}
|
||||
|
||||
auto GetStartBuf() const
|
||||
auto Data() const
|
||||
{
|
||||
return StartBuf;
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
|
||||
#include "../config/Config.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../peep/Peep.h"
|
||||
#include "../ride/Ride.h"
|
||||
|
@ -636,7 +637,7 @@ void award_update_all()
|
|||
gCurrentAwards[freeAwardEntryIndex].Time = 5;
|
||||
if (gConfigNotifications.park_award)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Award, AwardNewsStrings[awardType], 0);
|
||||
News::AddItemToQueue(News::ItemType::Award, AwardNewsStrings[awardType], 0, {});
|
||||
}
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ static void marketing_raise_finished_notification(const MarketingCampaign& campa
|
|||
{
|
||||
if (gConfigNotifications.park_marketing_campaign_finished)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
// This sets the string parameters for the marketing types that have an argument.
|
||||
if (campaign.Type == ADVERTISING_CAMPAIGN_RIDE_FREE || campaign.Type == ADVERTISING_CAMPAIGN_RIDE)
|
||||
{
|
||||
|
@ -85,7 +85,7 @@ static void marketing_raise_finished_notification(const MarketingCampaign& campa
|
|||
ft.Add<rct_string_id>(ShopItems[campaign.ShopItemType].Naming.Plural);
|
||||
}
|
||||
|
||||
News::AddItemToQueue(News::ItemType::Money, MarketingCampaignNames[campaign.Type][2], 0);
|
||||
News::AddItemToQueue(News::ItemType::Money, MarketingCampaignNames[campaign.Type][2], 0, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -301,13 +301,12 @@ News::Item* News::ItemQueues::FirstOpenOrNewSlot()
|
|||
*
|
||||
* rct2: 0x0066DF55
|
||||
*/
|
||||
News::Item* News::AddItemToQueue(News::ItemType type, rct_string_id string_id, uint32_t assoc)
|
||||
News::Item* News::AddItemToQueue(News::ItemType type, rct_string_id string_id, uint32_t assoc, const Formatter& formatter)
|
||||
{
|
||||
utf8 buffer[256];
|
||||
void* args = gCommonFormatArgs;
|
||||
|
||||
// overflows possible?
|
||||
format_string(buffer, 256, string_id, args);
|
||||
format_string(buffer, 256, string_id, formatter.Data());
|
||||
return News::AddItemToQueue(type, buffer, assoc);
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <optional>
|
||||
|
||||
struct CoordsXYZ;
|
||||
class Formatter;
|
||||
|
||||
namespace News
|
||||
{
|
||||
|
@ -288,7 +289,7 @@ namespace News
|
|||
|
||||
std::optional<CoordsXYZ> GetSubjectLocation(News::ItemType type, int32_t subject);
|
||||
|
||||
News::Item* AddItemToQueue(News::ItemType type, rct_string_id string_id, uint32_t assoc);
|
||||
News::Item* AddItemToQueue(News::ItemType type, rct_string_id string_id, uint32_t assoc, const Formatter& formatter);
|
||||
News::Item* AddItemToQueue(News::ItemType type, const utf8* text, uint32_t assoc);
|
||||
|
||||
void OpenSubject(News::ItemType type, int32_t subject);
|
||||
|
|
|
@ -240,7 +240,7 @@ void research_finish_item(ResearchItem* researchItem)
|
|||
}
|
||||
}
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
|
||||
// If a vehicle is the first to be invented for its ride type, show the ride type/group name.
|
||||
// Independently listed vehicles (like all flat rides and shops) should always be announced as such.
|
||||
|
@ -266,7 +266,7 @@ void research_finish_item(ResearchItem* researchItem)
|
|||
{
|
||||
if (gConfigNotifications.ride_researched)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Research, availabilityString, researchItem->rawValue);
|
||||
News::AddItemToQueue(News::ItemType::Research, availabilityString, researchItem->rawValue, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -281,7 +281,7 @@ void research_finish_item(ResearchItem* researchItem)
|
|||
{
|
||||
scenery_group_set_invented(researchItem->entryIndex);
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ft.Add<rct_string_id>(sceneryGroupEntry->name);
|
||||
|
||||
if (!gSilentResearch)
|
||||
|
@ -289,7 +289,7 @@ void research_finish_item(ResearchItem* researchItem)
|
|||
if (gConfigNotifications.ride_researched)
|
||||
{
|
||||
News::AddItemToQueue(
|
||||
News::ItemType::Research, STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE, researchItem->rawValue);
|
||||
News::ItemType::Research, STR_NEWS_ITEM_RESEARCH_NEW_SCENERY_SET_AVAILABLE, researchItem->rawValue, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -599,7 +599,7 @@ void NetworkBase::UpdateClient()
|
|||
|
||||
Close();
|
||||
context_force_close_window_by_class(WC_NETWORK_STATUS);
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE);
|
||||
context_show_error(STR_UNABLE_TO_CONNECT_TO_SERVER, STR_NONE, {});
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -2443,11 +2443,10 @@ void NetworkBase::Client_Handle_GAMESTATE(NetworkConnection& connection, Network
|
|||
{
|
||||
log_info("Wrote desync report to '%s'", outputFile.c_str());
|
||||
|
||||
uint8_t args[32]{};
|
||||
Formatter(args).Add<char*>(uniqueFileName);
|
||||
auto ft = Formatter().Add<char*>(uniqueFileName);
|
||||
|
||||
char str_desync[1024];
|
||||
format_string(str_desync, sizeof(str_desync), STR_DESYNC_REPORT, args);
|
||||
format_string(str_desync, sizeof(str_desync), STR_DESYNC_REPORT, ft.Data());
|
||||
|
||||
auto intent = Intent(WC_NETWORK_STATUS);
|
||||
intent.putExtra(INTENT_EXTRA_MESSAGE, std::string{ str_desync });
|
||||
|
@ -3116,7 +3115,7 @@ void NetworkBase::Client_Handle_SHOWERROR([[maybe_unused]] NetworkConnection& co
|
|||
{
|
||||
rct_string_id title, message;
|
||||
packet >> title >> message;
|
||||
context_show_error(title, message);
|
||||
context_show_error(title, message, {});
|
||||
}
|
||||
|
||||
void NetworkBase::Client_Handle_GROUPLIST([[maybe_unused]] NetworkConnection& connection, NetworkPacket& packet)
|
||||
|
|
|
@ -536,12 +536,11 @@ void Guest::UpdateEasterEggInteractions()
|
|||
|
||||
int32_t Guest::GetEasterEggNameId() const
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
char buffer[256]{};
|
||||
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
FormatNameTo(ft);
|
||||
format_string(buffer, sizeof(buffer), STR_STRINGID, args);
|
||||
format_string(buffer, sizeof(buffer), STR_STRINGID, ft.Data());
|
||||
|
||||
for (uint32_t i = 0; i < std::size(gPeepEasterEggNames); i++)
|
||||
if (_stricmp(buffer, gPeepEasterEggNames[i]) == 0)
|
||||
|
@ -684,12 +683,11 @@ void Guest::HandleEasterEggName()
|
|||
*/
|
||||
int32_t Guest::CheckEasterEggName(int32_t index) const
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
char buffer[256]{};
|
||||
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
FormatNameTo(ft);
|
||||
format_string(buffer, sizeof(buffer), STR_STRINGID, args);
|
||||
format_string(buffer, sizeof(buffer), STR_STRINGID, ft.Data());
|
||||
|
||||
return _stricmp(buffer, gPeepEasterEggNames[index]) == 0;
|
||||
}
|
||||
|
@ -1702,7 +1700,7 @@ loc_69B221:
|
|||
ft.Add<rct_string_id>(ShopItems[shopItem].Naming.Indefinite);
|
||||
if (gConfigNotifications.guest_bought_item)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_NOTIFICATION_BOUGHT_X, sprite_index);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_NOTIFICATION_BOUGHT_X, sprite_index, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3735,7 +3733,7 @@ void Guest::UpdateRideAdvanceThroughEntrance()
|
|||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_GUESTS_GETTING_STUCK_ON_RIDE, CurrentRide);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_GUESTS_GETTING_STUCK_ON_RIDE, CurrentRide, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3905,7 +3903,7 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride* ride)
|
|||
|
||||
if (gConfigNotifications.guest_on_ride)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, msg_string, sprite_index);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, msg_string, sprite_index, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5016,7 +5014,7 @@ void Guest::UpdateRideLeaveExit()
|
|||
|
||||
if (gConfigNotifications.guest_left_ride)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_RIDE_X, sprite_index);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_RIDE_X, sprite_index, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -872,7 +872,7 @@ void Peep::UpdateFalling()
|
|||
{
|
||||
auto ft = Formatter::Common();
|
||||
FormatNameTo(ft);
|
||||
News::AddItemToQueue(News::ItemType::Blank, STR_NEWS_ITEM_GUEST_DROWNED, x | (y << 16));
|
||||
News::AddItemToQueue(News::ItemType::Blank, STR_NEWS_ITEM_GUEST_DROWNED, x | (y << 16), ft);
|
||||
}
|
||||
|
||||
gParkRatingCasualtyPenalty = std::min(gParkRatingCasualtyPenalty + 25, 1000);
|
||||
|
@ -1238,7 +1238,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[0] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_ARE_HUNGRY, 20);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_ARE_HUNGRY, 20, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1249,7 +1249,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[1] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_ARE_THIRSTY, 21);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_ARE_THIRSTY, 21, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1260,7 +1260,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[2] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_CANT_FIND_TOILET, 22);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_CANT_FIND_TOILET, 22, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1271,7 +1271,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[3] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_DISLIKE_LITTER, 26);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_DISLIKE_LITTER, 26, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1282,7 +1282,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[4] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_DISGUSTED_BY_PATHS, 31);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_DISGUSTED_BY_PATHS, 31, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1293,7 +1293,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[5] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_DISLIKE_VANDALISM, 33);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_DISLIKE_VANDALISM, 33, {});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1304,7 +1304,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[6] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_GETTING_LOST_OR_STUCK, 27);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_GETTING_LOST_OR_STUCK, 27, {});
|
||||
}
|
||||
}
|
||||
else if (lost_counter >= PEEP_LOST_WARNING_THRESHOLD)
|
||||
|
@ -1312,7 +1312,7 @@ void peep_problem_warnings_update()
|
|||
warning_throttle[6] = 4;
|
||||
if (gConfigNotifications.guest_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_GETTING_LOST_OR_STUCK, 16);
|
||||
News::AddItemToQueue(News::ItemType::Peeps, STR_PEEPS_GETTING_LOST_OR_STUCK, 16, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1967,11 +1967,9 @@ void Peep::FormatNameTo(Formatter& ft) const
|
|||
|
||||
std::string Peep::GetName() const
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
FormatNameTo(ft);
|
||||
return format_string(STR_STRINGID, args);
|
||||
return format_string(STR_STRINGID, ft.Data());
|
||||
}
|
||||
|
||||
bool Peep::SetName(const std::string_view& value)
|
||||
|
@ -2398,7 +2396,8 @@ static void peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
|
|||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.guest_queuing_for_ride)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index);
|
||||
News::AddItemToQueue(
|
||||
News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2459,7 +2458,7 @@ static void peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
|
|||
peep->FormatNameTo(ft);
|
||||
if (gConfigNotifications.guest_left_park)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_PARK, peep->sprite_index);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_PARK, peep->sprite_index, ft);
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -2827,7 +2826,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords)
|
|||
if (gConfigNotifications.guest_queuing_for_ride)
|
||||
{
|
||||
News::AddItemToQueue(
|
||||
News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index);
|
||||
News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, peep->sprite_index, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2937,7 +2936,7 @@ static bool peep_interact_with_shop(Peep* peep, const CoordsXYE& coords)
|
|||
: STR_PEEP_TRACKING_PEEP_IS_ON_X;
|
||||
if (gConfigNotifications.guest_used_facility)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, string_id, peep->sprite_index);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, string_id, peep->sprite_index, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3230,17 +3229,15 @@ int32_t peep_compare(const uint16_t sprite_index_a, const uint16_t sprite_index_
|
|||
}
|
||||
|
||||
// Compare their names as strings
|
||||
uint8_t args[32]{};
|
||||
|
||||
char nameA[256]{};
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
peep_a->FormatNameTo(ft);
|
||||
format_string(nameA, sizeof(nameA), STR_STRINGID, args);
|
||||
format_string(nameA, sizeof(nameA), STR_STRINGID, ft.Data());
|
||||
|
||||
char nameB[256]{};
|
||||
ft = Formatter(args);
|
||||
ft.Rewind();
|
||||
peep_b->FormatNameTo(ft);
|
||||
format_string(nameB, sizeof(nameB), STR_STRINGID, args);
|
||||
format_string(nameB, sizeof(nameB), STR_STRINGID, ft.Data());
|
||||
return strlogicalcmp(nameA, nameB);
|
||||
}
|
||||
|
||||
|
|
|
@ -1696,9 +1696,9 @@ static void show_error(uint8_t errorType, rct_string_id errorStringId)
|
|||
{
|
||||
if (errorType == ERROR_TYPE_GENERIC)
|
||||
{
|
||||
context_show_error(errorStringId, 0xFFFF);
|
||||
context_show_error(errorStringId, STR_NONE, {});
|
||||
}
|
||||
context_show_error(STR_UNABLE_TO_LOAD_FILE, errorStringId);
|
||||
context_show_error(STR_UNABLE_TO_LOAD_FILE, errorStringId, {});
|
||||
}
|
||||
|
||||
void load_from_sv6(const char* path)
|
||||
|
|
|
@ -942,27 +942,26 @@ void reset_all_ride_build_dates()
|
|||
|
||||
static int32_t ride_check_if_construction_allowed(Ride* ride)
|
||||
{
|
||||
Formatter ft;
|
||||
rct_ride_entry* rideEntry = ride->GetRideEntry();
|
||||
if (rideEntry == nullptr)
|
||||
{
|
||||
context_show_error(STR_INVALID_RIDE_TYPE, STR_CANT_EDIT_INVALID_RIDE_TYPE);
|
||||
context_show_error(STR_INVALID_RIDE_TYPE, STR_CANT_EDIT_INVALID_RIDE_TYPE, ft);
|
||||
return 0;
|
||||
}
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_BROKEN_DOWN)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING);
|
||||
context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_HAS_BROKEN_DOWN_AND_REQUIRES_FIXING, ft);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (ride->status != RIDE_STATUS_CLOSED && ride->status != RIDE_STATUS_SIMULATING)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST);
|
||||
context_show_error(STR_CANT_START_CONSTRUCTION_ON, STR_MUST_BE_CLOSED_FIRST, ft);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1827,11 +1826,11 @@ bool ride_modify(CoordsXYE* input)
|
|||
|
||||
if (ride->lifecycle_flags & RIDE_LIFECYCLE_INDESTRUCTIBLE)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ft.Increment(6);
|
||||
ride->FormatNameTo(ft);
|
||||
context_show_error(
|
||||
STR_CANT_START_CONSTRUCTION_ON, STR_LOCAL_AUTHORITY_FORBIDS_DEMOLITION_OR_MODIFICATIONS_TO_THIS_RIDE);
|
||||
STR_CANT_START_CONSTRUCTION_ON, STR_LOCAL_AUTHORITY_FORBIDS_DEMOLITION_OR_MODIFICATIONS_TO_THIS_RIDE, ft);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1991,13 +1990,13 @@ std::unique_ptr<TrackDesign> Ride::SaveToTrackDesign() const
|
|||
{
|
||||
if (!(lifecycle_flags & RIDE_LIFECYCLE_TESTED))
|
||||
{
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE);
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {});
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!ride_has_ratings(this))
|
||||
{
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE);
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {});
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2005,7 +2004,7 @@ std::unique_ptr<TrackDesign> Ride::SaveToTrackDesign() const
|
|||
auto errMessage = td->CreateTrackDesign(*this);
|
||||
if (errMessage != STR_NONE)
|
||||
{
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, errMessage);
|
||||
context_show_error(STR_CANT_SAVE_TRACK_DESIGN, errMessage, {});
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -2529,11 +2528,11 @@ void ride_prepare_breakdown(Ride* ride, int32_t breakdownReason)
|
|||
*/
|
||||
void ride_breakdown_add_news_item(Ride* ride)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_broken_down)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_BROKEN_DOWN, ride->id);
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_BROKEN_DOWN, ride->id, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2556,11 +2555,11 @@ static void ride_breakdown_status_update(Ride* ride)
|
|||
if (!(ride->not_fixed_timeout & 15) && ride->mechanic_status != RIDE_MECHANIC_STATUS_FIXING
|
||||
&& ride->mechanic_status != RIDE_MECHANIC_STATUS_HAS_FIXED_STATION_BRAKES)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_STILL_NOT_FIXED, ride->id);
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_IS_STILL_NOT_FIXED, ride->id, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3194,11 +3193,11 @@ static void ride_entrance_exit_connected(Ride* ride)
|
|||
if (!entrance.isNull() && !ride_entrance_exit_is_reachable(entrance))
|
||||
{
|
||||
// name of ride is parameter of the format string
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, ride->id);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, ride->id, ft);
|
||||
}
|
||||
ride->connected_message_throttle = 3;
|
||||
}
|
||||
|
@ -3206,11 +3205,11 @@ static void ride_entrance_exit_connected(Ride* ride)
|
|||
if (!exit.isNull() && !ride_entrance_exit_is_reachable(exit))
|
||||
{
|
||||
// name of ride is parameter of the format string
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_EXIT_NOT_CONNECTED, ride->id);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_EXIT_NOT_CONNECTED, ride->id, ft);
|
||||
}
|
||||
ride->connected_message_throttle = 3;
|
||||
}
|
||||
|
@ -3282,11 +3281,11 @@ static void ride_shop_connected(Ride* ride)
|
|||
}
|
||||
|
||||
// Name of ride is parameter of the format string
|
||||
auto ft = Formatter::Common();
|
||||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, ride->id);
|
||||
Formatter ft;
|
||||
ride->FormatNameTo(ft);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_ENTRANCE_NOT_CONNECTED, ride->id, ft);
|
||||
}
|
||||
|
||||
ride->connected_message_throttle = 3;
|
||||
|
@ -5498,15 +5497,13 @@ static bool ride_with_colour_config_exists(uint8_t ride_type, const TrackColour*
|
|||
bool Ride::NameExists(const std::string_view& name, ride_id_t excludeRideId)
|
||||
{
|
||||
char buffer[256]{};
|
||||
uint8_t formatArgs[32]{};
|
||||
|
||||
for (auto& ride : GetRideManager())
|
||||
{
|
||||
if (ride.id != excludeRideId)
|
||||
{
|
||||
Formatter ft(formatArgs);
|
||||
Formatter ft;
|
||||
ride.FormatNameTo(ft);
|
||||
format_string(buffer, 256, STR_STRINGID, formatArgs);
|
||||
format_string(buffer, 256, STR_STRINGID, ft.Data());
|
||||
if (std::string_view(buffer) == name && ride_has_any_track_elements(&ride))
|
||||
{
|
||||
return true;
|
||||
|
@ -5590,7 +5587,6 @@ money32 ride_get_common_price(Ride* forRide)
|
|||
void Ride::SetNameToDefault()
|
||||
{
|
||||
char rideNameBuffer[256]{};
|
||||
uint8_t rideNameArgs[32]{};
|
||||
|
||||
// Increment default name number until we find a unique name
|
||||
custom_name = {};
|
||||
|
@ -5598,9 +5594,9 @@ void Ride::SetNameToDefault()
|
|||
do
|
||||
{
|
||||
default_name_number++;
|
||||
Formatter ft(rideNameArgs);
|
||||
Formatter ft;
|
||||
FormatNameTo(ft);
|
||||
format_string(rideNameBuffer, 256, STR_STRINGID, &rideNameArgs);
|
||||
format_string(rideNameBuffer, 256, STR_STRINGID, ft.Data());
|
||||
} while (Ride::NameExists(rideNameBuffer, id));
|
||||
}
|
||||
|
||||
|
@ -7057,11 +7053,11 @@ void Ride::Crash(uint8_t vehicleIndex)
|
|||
}
|
||||
}
|
||||
|
||||
auto ft = Formatter::Common();
|
||||
FormatNameTo(ft);
|
||||
if (gConfigNotifications.ride_crashed)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_HAS_CRASHED, id);
|
||||
Formatter ft;
|
||||
FormatNameTo(ft);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_RIDE_HAS_CRASHED, id, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7565,11 +7561,9 @@ void ride_clear_leftover_entrances(Ride* ride)
|
|||
|
||||
std::string Ride::GetName() const
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
FormatNameTo(ft);
|
||||
return format_string(STR_STRINGID, args);
|
||||
return format_string(STR_STRINGID, ft.Data());
|
||||
}
|
||||
|
||||
void Ride::FormatNameTo(Formatter& ft) const
|
||||
|
|
|
@ -73,7 +73,7 @@ void track_design_save_select_tile_element(int32_t interactionType, const Coords
|
|||
{
|
||||
context_show_error(
|
||||
STR_SAVE_TRACK_SCENERY_UNABLE_TO_SELECT_ADDITIONAL_ITEM_OF_SCENERY,
|
||||
STR_SAVE_TRACK_SCENERY_TOO_MANY_ITEMS_SELECTED);
|
||||
STR_SAVE_TRACK_SCENERY_TOO_MANY_ITEMS_SELECTED, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3469,7 +3469,7 @@ void Vehicle::CheckIfMissing()
|
|||
|
||||
if (gConfigNotifications.ride_stalled_vehicles)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ft.Add<rct_string_id>(RideComponentNames[RideTypeDescriptors[curRide->type].NameConvention.vehicle].number);
|
||||
|
||||
uint8_t vehicleIndex = 0;
|
||||
|
@ -3482,7 +3482,7 @@ void Vehicle::CheckIfMissing()
|
|||
curRide->FormatNameTo(ft);
|
||||
ft.Add<rct_string_id>(RideComponentNames[RideTypeDescriptors[curRide->type].NameConvention.station].singular);
|
||||
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_NEWS_VEHICLE_HAS_STALLED, ride);
|
||||
News::AddItemToQueue(News::ItemType::Ride, STR_NEWS_VEHICLE_HAS_STALLED, ride, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5191,7 +5191,7 @@ static TileElement* vehicle_check_collision(const CoordsXYZ& vehiclePosition)
|
|||
|
||||
static void ride_train_crash(Ride* ride, uint16_t numFatalities)
|
||||
{
|
||||
auto ft = Formatter::Common();
|
||||
Formatter ft;
|
||||
ft.Add<uint16_t>(numFatalities);
|
||||
|
||||
uint8_t crashType = numFatalities == 0 ? RIDE_CRASH_TYPE_NO_FATALITIES : RIDE_CRASH_TYPE_FATALITIES;
|
||||
|
@ -5205,7 +5205,7 @@ static void ride_train_crash(Ride* ride, uint16_t numFatalities)
|
|||
{
|
||||
ride->FormatNameTo(ft);
|
||||
News::AddItemToQueue(
|
||||
News::ItemType::Ride, numFatalities == 1 ? STR_X_PERSON_DIED_ON_X : STR_X_PEOPLE_DIED_ON_X, ride->id);
|
||||
News::ItemType::Ride, numFatalities == 1 ? STR_X_PERSON_DIED_ON_X : STR_X_PEOPLE_DIED_ON_X, ride->id, ft);
|
||||
}
|
||||
|
||||
if (gParkRatingCasualtyPenalty < 500)
|
||||
|
|
|
@ -243,7 +243,7 @@ static void scenario_entrance_fee_too_high_check()
|
|||
uint32_t packed_xy = (y << 16) | x;
|
||||
if (gConfigNotifications.park_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Blank, STR_ENTRANCE_FEE_TOO_HI, packed_xy);
|
||||
News::AddItemToQueue(News::ItemType::Blank, STR_ENTRANCE_FEE_TOO_HI, packed_xy, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -794,33 +794,33 @@ ObjectiveStatus Objective::CheckGuestsAndRating() const
|
|||
{
|
||||
if (gConfigNotifications.park_rating_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_4_WEEKS_REMAINING, 0);
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_4_WEEKS_REMAINING, 0, {});
|
||||
}
|
||||
}
|
||||
else if (gScenarioParkRatingWarningDays == 8)
|
||||
{
|
||||
if (gConfigNotifications.park_rating_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_3_WEEKS_REMAINING, 0);
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_3_WEEKS_REMAINING, 0, {});
|
||||
}
|
||||
}
|
||||
else if (gScenarioParkRatingWarningDays == 15)
|
||||
{
|
||||
if (gConfigNotifications.park_rating_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_2_WEEKS_REMAINING, 0);
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_2_WEEKS_REMAINING, 0, {});
|
||||
}
|
||||
}
|
||||
else if (gScenarioParkRatingWarningDays == 22)
|
||||
{
|
||||
if (gConfigNotifications.park_rating_warnings)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_1_WEEK_REMAINING, 0);
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_RATING_WARNING_1_WEEK_REMAINING, 0, {});
|
||||
}
|
||||
}
|
||||
else if (gScenarioParkRatingWarningDays == 29)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0);
|
||||
News::AddItemToQueue(News::ItemType::Graph, STR_PARK_HAS_BEEN_CLOSED_DOWN, 0, {});
|
||||
gParkFlags &= ~PARK_FLAGS_PARK_OPEN;
|
||||
gGuestInitialHappiness = 50;
|
||||
return ObjectiveStatus::Failure;
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace OpenRCT2::Ui
|
|||
{
|
||||
return nullptr;
|
||||
}
|
||||
rct_window* ShowError(rct_string_id /*title*/, rct_string_id /*message*/) override
|
||||
rct_window* ShowError(rct_string_id /*title*/, rct_string_id /*message*/, const Formatter& /*formatter*/) override
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
class Formatter;
|
||||
|
||||
namespace OpenRCT2::Ui
|
||||
{
|
||||
/**
|
||||
|
@ -29,7 +31,7 @@ namespace OpenRCT2::Ui
|
|||
virtual rct_window* OpenDetails(uint8_t type, int32_t id) abstract;
|
||||
virtual rct_window* OpenIntent(Intent* intent) abstract;
|
||||
virtual void BroadcastIntent(const Intent& intent) abstract;
|
||||
virtual rct_window* ShowError(rct_string_id title, rct_string_id message) abstract;
|
||||
virtual rct_window* ShowError(rct_string_id title, rct_string_id message, const Formatter& formatter) abstract;
|
||||
virtual rct_window* ShowError(const std::string_view& title, const std::string_view& message) abstract;
|
||||
virtual void ForceClose(rct_windowclass windowClass) abstract;
|
||||
virtual void UpdateMapTooltip() abstract;
|
||||
|
|
|
@ -59,10 +59,9 @@ static constexpr CodePointToUtf8<FORMAT_COLOUR_CODE_START, FORMAT_COLOUR_CODE_EN
|
|||
|
||||
std::string Banner::GetText() const
|
||||
{
|
||||
uint8_t args[32]{};
|
||||
Formatter ft(args);
|
||||
Formatter ft;
|
||||
FormatTextTo(ft);
|
||||
return format_string(STR_STRINGID, args);
|
||||
return format_string(STR_STRINGID, ft.Data());
|
||||
}
|
||||
|
||||
void Banner::FormatTextTo(Formatter& ft, bool addColour) const
|
||||
|
@ -79,7 +78,7 @@ void Banner::FormatTextTo(Formatter& ft) const
|
|||
{
|
||||
if (flags & BANNER_FLAG_NO_ENTRY)
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_NO_ENTRY).NumBytes();
|
||||
ft.Add<rct_string_id>(STR_NO_ENTRY);
|
||||
}
|
||||
else if (flags & BANNER_FLAG_LINKED_TO_RIDE)
|
||||
{
|
||||
|
@ -90,16 +89,16 @@ void Banner::FormatTextTo(Formatter& ft) const
|
|||
}
|
||||
else
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_DEFAULT_SIGN).NumBytes();
|
||||
ft.Add<rct_string_id>(STR_DEFAULT_SIGN);
|
||||
}
|
||||
}
|
||||
else if (text.empty())
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_DEFAULT_SIGN).NumBytes();
|
||||
ft.Add<rct_string_id>(STR_DEFAULT_SIGN);
|
||||
}
|
||||
else
|
||||
{
|
||||
ft.Add<rct_string_id>(STR_STRING).Add<const char*>(text.c_str()).NumBytes();
|
||||
ft.Add<rct_string_id>(STR_STRING).Add<const char*>(text.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "../core/Guard.hpp"
|
||||
#include "../core/Imaging.h"
|
||||
#include "../core/String.hpp"
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../localisation/StringIds.h"
|
||||
#include "../object/Object.h"
|
||||
#include "../platform/platform.h"
|
||||
|
@ -658,14 +659,14 @@ bool mapgen_load_heightmap(const utf8* path)
|
|||
auto image = Imaging::ReadFromFile(path, format);
|
||||
if (image.Width != image.Height)
|
||||
{
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_WIDTH_AND_HEIGHT_DO_NOT_MATCH);
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_WIDTH_AND_HEIGHT_DO_NOT_MATCH, {});
|
||||
return false;
|
||||
}
|
||||
|
||||
auto size = image.Width;
|
||||
if (image.Width > MAXIMUM_MAP_SIZE_PRACTICAL)
|
||||
{
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_HEIHGT_MAP_TOO_BIG);
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_HEIHGT_MAP_TOO_BIG, {});
|
||||
size = std::min<uint32_t>(image.Height, MAXIMUM_MAP_SIZE_PRACTICAL);
|
||||
}
|
||||
|
||||
|
@ -696,10 +697,10 @@ bool mapgen_load_heightmap(const utf8* path)
|
|||
switch (format)
|
||||
{
|
||||
case IMAGE_FORMAT::BITMAP:
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_BITMAP);
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_BITMAP, {});
|
||||
break;
|
||||
case IMAGE_FORMAT::PNG_32:
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_PNG);
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_READING_PNG, {});
|
||||
break;
|
||||
default:
|
||||
log_error("Unable to load height map image: %s", e.what());
|
||||
|
@ -804,7 +805,7 @@ void mapgen_generate_from_heightmap(mapgen_settings* settings)
|
|||
|
||||
if (minValue == maxValue)
|
||||
{
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_CANNOT_NORMALIZE);
|
||||
context_show_error(STR_HEIGHT_MAP_ERROR, STR_ERROR_CANNOT_NORMALIZE, {});
|
||||
delete[] dest;
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue