Merge pull request #19741 from janisozaur/fix-windows-closing

Fix windows closing
This commit is contained in:
Michał Janiszewski 2023-03-28 12:03:50 +02:00 committed by GitHub
commit d703a95161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 6 deletions

View File

@ -619,6 +619,7 @@ public:
if (inventionListWindow == nullptr)
{
Close();
return;
}
std::optional<InventionListItem> res;
// Skip always researched items, so that the dragged item gets placed underneath them

View File

@ -599,12 +599,14 @@ public:
if (!objectSelectResult.Successful)
return;
// Close any other open windows such as options/colour schemes to prevent a crash.
WindowCloseAll();
// WindowClose(*w);
auto& objRepository = OpenRCT2::GetContext()->GetObjectRepository();
_loadedObject = objRepository.LoadObject(listItem->repositoryItem);
auto& objManager = OpenRCT2::GetContext()->GetObjectManager();
objManager.LoadObject(_loadedObject.get()->GetIdentifier());
// This function calls window_track_list_open
ManageTracks();
Close();
return;
}
@ -1485,7 +1487,7 @@ private:
{
for (size_t i = 0; i < std::size(ObjectSelectionPages); i++)
{
pressed_widgets &= ~(1 << (WIDX_TAB_1 + i));
pressed_widgets &= ~(1ull << (WIDX_TAB_1 + i));
}
pressed_widgets |= 1LL << (WIDX_TAB_1 + selected_tab);
}

View File

@ -207,7 +207,7 @@ public:
{
case WIDX_CLOSE:
Close();
break;
return;
case WIDX_TAB_1:
case WIDX_TAB_2:
case WIDX_TAB_3:
@ -216,7 +216,7 @@ public:
case WIDX_TAB_6:
case WIDX_TAB_7:
SetPage(widx - WIDX_TAB_1);
break;
return;
}
switch (page)