From c5b5b95bcd8d1f97e7a56add30da7d2ff2430968 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 23 Mar 2022 00:01:52 +0000 Subject: [PATCH] Show better errors when loading scenery groups (#16854) --- .../windows/EditorObjectSelection.cpp | 16 ++++++++++++---- src/openrct2/EditorObjectSelectionSession.cpp | 4 ++-- src/openrct2/EditorObjectSelectionSession.h | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/openrct2-ui/windows/EditorObjectSelection.cpp b/src/openrct2-ui/windows/EditorObjectSelection.cpp index 47dc405c7e..3319243e13 100644 --- a/src/openrct2-ui/windows/EditorObjectSelection.cpp +++ b/src/openrct2-ui/windows/EditorObjectSelection.cpp @@ -588,7 +588,7 @@ public: if (!(object_selection_flags & ObjectSelectionFlags::Selected)) inputFlags |= INPUT_FLAG_EDITOR_OBJECT_SELECT; - _maxObjectsWasHit = false; + _gSceneryGroupPartialSelectError = false; if (!window_editor_object_selection_select_object(0, inputFlags, listItem->repositoryItem)) { rct_string_id error_title = (inputFlags & INPUT_FLAG_EDITOR_OBJECT_SELECT) ? STR_UNABLE_TO_SELECT_THIS_OBJECT @@ -605,10 +605,18 @@ public: Invalidate(); } - if (_maxObjectsWasHit) + if (_gSceneryGroupPartialSelectError) { - context_show_error( - STR_WARNING_TOO_MANY_OBJECTS_SELECTED, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, {}); + if (gGameCommandErrorText == 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, {}); + } + else + { + context_show_error( + gGameCommandErrorText, STR_NOT_ALL_OBJECTS_IN_THIS_SCENERY_GROUP_COULD_BE_SELECTED, Formatter::Common()); + } } } diff --git a/src/openrct2/EditorObjectSelectionSession.cpp b/src/openrct2/EditorObjectSelectionSession.cpp index bb251521c2..29f600fe1e 100644 --- a/src/openrct2/EditorObjectSelectionSession.cpp +++ b/src/openrct2/EditorObjectSelectionSession.cpp @@ -33,7 +33,7 @@ #include #include -bool _maxObjectsWasHit; +bool _gSceneryGroupPartialSelectError; std::vector _objectSelectionFlags; int32_t _numSelectedObjectsForType[EnumValue(ObjectType::Count)]; static int32_t _numAvailableObjectsForType[EnumValue(ObjectType::Count)]; @@ -581,7 +581,7 @@ bool window_editor_object_selection_select_object(uint8_t isMasterObject, int32_ { if (!window_editor_object_selection_select_object(++isMasterObject, flags, sgEntry)) { - _maxObjectsWasHit = true; + _gSceneryGroupPartialSelectError = true; } } } diff --git a/src/openrct2/EditorObjectSelectionSession.h b/src/openrct2/EditorObjectSelectionSession.h index 9df783e8b7..d543200e1c 100644 --- a/src/openrct2/EditorObjectSelectionSession.h +++ b/src/openrct2/EditorObjectSelectionSession.h @@ -23,7 +23,7 @@ enum EDITOR_INPUT_FLAGS INPUT_FLAG_EDITOR_OBJECT_ALWAYS_REQUIRED = (1 << 3) }; -extern bool _maxObjectsWasHit; +extern bool _gSceneryGroupPartialSelectError; extern std::vector _objectSelectionFlags; extern int32_t _numSelectedObjectsForType[EnumValue(ObjectType::Count)];