1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00

Remove remaining usages of gGameCommandErrorText

This commit is contained in:
Michael Steenbeek
2022-07-30 18:04:59 +02:00
committed by GitHub
parent 142b9ff243
commit 0bfc151ab9
20 changed files with 157 additions and 173 deletions

View File

@@ -594,7 +594,9 @@ public:
if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER)
{
if (!window_editor_object_selection_select_object(0, INPUT_FLAG_EDITOR_OBJECT_SELECT, listItem->repositoryItem))
const auto objectSelectResult = window_editor_object_selection_select_object(
0, INPUT_FLAG_EDITOR_OBJECT_SELECT, listItem->repositoryItem);
if (!objectSelectResult.Successful)
return;
// Close any other open windows such as options/colour schemes to prevent a crash.
@@ -611,13 +613,14 @@ public:
if (!(object_selection_flags & ObjectSelectionFlags::Selected))
inputFlags |= INPUT_FLAG_EDITOR_OBJECT_SELECT;
_gSceneryGroupPartialSelectError = false;
if (!window_editor_object_selection_select_object(0, inputFlags, listItem->repositoryItem))
_gSceneryGroupPartialSelectError = std::nullopt;
const auto objectSelectResult = window_editor_object_selection_select_object(0, inputFlags, listItem->repositoryItem);
if (!objectSelectResult.Successful)
{
rct_string_id error_title = (inputFlags & INPUT_FLAG_EDITOR_OBJECT_SELECT) ? STR_UNABLE_TO_SELECT_THIS_OBJECT
: STR_UNABLE_TO_DE_SELECT_THIS_OBJECT;
context_show_error(error_title, gGameCommandErrorText, {});
context_show_error(error_title, objectSelectResult.Message, {});
return;
}
@@ -628,9 +631,10 @@ public:
Invalidate();
}
if (_gSceneryGroupPartialSelectError)
if (_gSceneryGroupPartialSelectError.has_value())
{
if (gGameCommandErrorText == STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED)
const auto errorMessage = _gSceneryGroupPartialSelectError.value();
if (errorMessage == STR_OBJECT_SELECTION_ERR_TOO_MANY_OF_TYPE_SELECTED)
{
context_show_error(
STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, {});
@@ -638,7 +642,7 @@ public:
else
{
context_show_error(
gGameCommandErrorText, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, Formatter::Common());
errorMessage, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, Formatter::Common());
}
}
}