mirror of https://github.com/OpenRCT2/OpenRCT2.git
Fix #21317: Track designer allows proceeding without an object selected
Co-authored-by: Gymnasiast <m.o.steenbeek@gmail.com>
This commit is contained in:
parent
7c65a372aa
commit
bf20a6d146
|
@ -18,6 +18,8 @@
|
|||
- Fix: [#910] Extra viewport does not preserve the location when rotating.
|
||||
- Fix: [#18413] Crash when mouse over a hacked train.
|
||||
- Fix: [#20338] Cannot select Scenery Picker or Scatter Tool when the scenery recolouring tool is active.
|
||||
- Fix: [#21317] Track designer allows proceeding without an object selected.
|
||||
- Fix: [#21360] If the object selection is missing certain types, the Object Selection window will switch to an incorrect tab.
|
||||
- Fix: [#21419] Cannot place walls underground beneath sloped tiles with clearance checks disabled.
|
||||
- Fix: [#21434] Number of guests overflows in objective text.
|
||||
- Fix: [#21543] Crash with creating a TrackIterator with invalid arguments.
|
||||
|
|
|
@ -186,30 +186,9 @@ static Widget _editorBottomToolbarWidgets[] = {
|
|||
GfxInvalidateScreen();
|
||||
}
|
||||
|
||||
bool CheckObjectSelection() const
|
||||
{
|
||||
WindowBase* w;
|
||||
|
||||
auto [missingObjectType, errorString] = Editor::CheckObjectSelection();
|
||||
if (missingObjectType == ObjectType::None)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::EditorObjectSelection);
|
||||
return true;
|
||||
}
|
||||
|
||||
ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {});
|
||||
w = WindowFindByClass(WindowClass::EditorObjectSelection);
|
||||
if (w != nullptr)
|
||||
{
|
||||
// Click tab with missing object
|
||||
w->OnMouseUp(WC_EDITOR_OBJECT_SELECTION__WIDX_TAB_1 + EnumValue(missingObjectType));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void JumpForwardFromObjectSelection() const
|
||||
{
|
||||
if (!CheckObjectSelection())
|
||||
if (!EditorObjectSelectionWindowCheck())
|
||||
return;
|
||||
|
||||
FinishObjectSelection();
|
||||
|
|
|
@ -357,7 +357,9 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
WindowClose(*this);
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) && !EditorObjectSelectionWindowCheck())
|
||||
return;
|
||||
|
||||
if (gScreenFlags & SCREEN_FLAGS_EDITOR)
|
||||
{
|
||||
FinishObjectSelection();
|
||||
|
@ -1108,6 +1110,18 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
DrawDebugData(dpi);
|
||||
}
|
||||
|
||||
void GoToTab(ObjectType objectType)
|
||||
{
|
||||
for (size_t offset = 0; offset < std::size(TabOrder); offset++)
|
||||
{
|
||||
if (TabOrder[offset] == objectType)
|
||||
{
|
||||
SetPage(offset);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
void InitWidgets()
|
||||
{
|
||||
|
@ -1660,4 +1674,25 @@ static std::vector<Widget> _window_editor_object_selection_widgets = {
|
|||
if (showFallbackWarning)
|
||||
ContextShowError(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter::Common());
|
||||
}
|
||||
|
||||
bool EditorObjectSelectionWindowCheck()
|
||||
{
|
||||
WindowBase* w;
|
||||
|
||||
auto [missingObjectType, errorString] = Editor::CheckObjectSelection();
|
||||
if (missingObjectType == ObjectType::None)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::EditorObjectSelection);
|
||||
return true;
|
||||
}
|
||||
|
||||
ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {});
|
||||
w = WindowFindByClass(WindowClass::EditorObjectSelection);
|
||||
if (w != nullptr)
|
||||
{
|
||||
// Click tab with missing object
|
||||
static_cast<EditorObjectSelectionWindow*>(w)->GoToTab(missingObjectType);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -207,6 +207,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
void WindowTileInspectorClearClipboard();
|
||||
|
||||
WindowBase* EditorObjectSelectionOpen();
|
||||
bool EditorObjectSelectionWindowCheck();
|
||||
|
||||
void WindowTooltipReset(const ScreenCoordsXY& screenCoords);
|
||||
void WindowTooltipShow(const OpenRCT2String& message, ScreenCoordsXY screenCoords);
|
||||
|
|
Loading…
Reference in New Issue