1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-23 15:52:55 +01:00

Close #12413: Refactor VISIBILITY_CACHE to use strong enum (#13136)

This commit is contained in:
Bryan DiLaura
2020-10-09 16:12:14 -06:00
committed by GitHub
parent 3468d1fc6b
commit 7c95f594d3
4 changed files with 19 additions and 17 deletions

View File

@@ -1969,16 +1969,16 @@ bool window_is_visible(rct_window* w)
if (w == nullptr)
return false;
if (w->visibility == VC_VISIBLE)
if (w->visibility == VisibilityCache::Visible)
return true;
if (w->visibility == VC_COVERED)
if (w->visibility == VisibilityCache::Covered)
return false;
// only consider viewports, consider the main window always visible
if (w->viewport == nullptr || w->classification == WC_MAIN_WINDOW)
{
// default to previous behaviour
w->visibility = VC_VISIBLE;
w->visibility = VisibilityCache::Visible;
return true;
}
@@ -1993,15 +1993,15 @@ bool window_is_visible(rct_window* w)
&& w_other.windowPos.x + w_other.width >= w->windowPos.x + w->width
&& w_other.windowPos.y + w_other.height >= w->windowPos.y + w->height)
{
w->visibility = VC_COVERED;
w->viewport->visibility = VC_COVERED;
w->visibility = VisibilityCache::Covered;
w->viewport->visibility = VisibilityCache::Covered;
return false;
}
}
// default to previous behaviour
w->visibility = VC_VISIBLE;
w->viewport->visibility = VC_VISIBLE;
w->visibility = VisibilityCache::Visible;
w->viewport->visibility = VisibilityCache::Visible;
return true;
}
@@ -2052,10 +2052,10 @@ void window_reset_visibilities()
{
// reset window visibility status to unknown
window_visit_each([](rct_window* w) {
w->visibility = VC_UNKNOWN;
w->visibility = VisibilityCache::Unknown;
if (w->viewport != nullptr)
{
w->viewport->visibility = VC_UNKNOWN;
w->viewport->visibility = VisibilityCache::Unknown;
}
});
}