Explicitly pass formatter arguments to ShowError and family

This commit is contained in:
Matt 2020-08-27 00:01:15 +02:00
parent 2639349925
commit ccde06ab0f
No known key found for this signature in database
GPG Key ID: 6D4C24A61C93E208
32 changed files with 152 additions and 146 deletions

View File

@ -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:

View File

@ -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

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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, {});
}
}

View File

@ -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
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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, {});
}
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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
{

View File

@ -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;
}
}

View File

@ -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;

View File

@ -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, {});
}
}

View File

@ -415,8 +415,9 @@ 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);
Formatter ft;
ft.Add<rct_string_id>(StaffNamingConvention[selectedPeepType].plural);
context_show_error(STR_NO_THING_IN_PARK_YET, STR_NONE, ft);
}
}
}

View File

@ -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;
}

View File

@ -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;
}
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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);

View File

@ -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);

View File

@ -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,9 @@ 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);
Formatter ft;
ft.Add<uint16_t>(e.Flag);
windowManager->ShowError(STR_FAILED_TO_LOAD_IMCOMPATIBLE_RCTC_FLAG, STR_NONE, ft);
}
catch (const std::exception& e)
{
@ -1369,10 +1370,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()

View File

@ -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);

View File

@ -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);

View File

@ -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;
}
}
@ -3116,7 +3116,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)

View File

@ -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)

View File

@ -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;
}

View File

@ -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, {});
}
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;
}