1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-20 06:12:57 +01:00

Move vehicle sounds update into Ui library (#21577)

* Move vehicle sounds update into Ui library

* Add missing statics

* Apply review comments

* Sprinkle some const

* Clang format accumulate
This commit is contained in:
Duncan
2024-03-20 11:14:52 +00:00
committed by GitHub
parent 3f81a491b0
commit 5a70fd97fb
11 changed files with 654 additions and 620 deletions

View File

@@ -832,3 +832,31 @@ ScreenCoordsXY WindowGetViewportSoundIconPos(WindowBase& w)
const uint8_t buttonOffset = (gConfigInterface.WindowButtonsOnTheLeft) ? CloseButtonWidth + 2 : 0;
return w.windowPos + ScreenCoordsXY{ 2 + buttonOffset, 2 };
}
namespace OpenRCT2::Ui::Windows
{
WindowBase* WindowGetListening()
{
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
{
auto& w = **it;
if (w.flags & WF_DEAD)
continue;
auto viewport = w.viewport;
if (viewport != nullptr)
{
if (viewport->flags & VIEWPORT_FLAG_SOUND_ON)
{
return &w;
}
}
}
return nullptr;
}
WindowClass WindowGetClassification(const WindowBase& window)
{
return window.classification;
}
} // namespace OpenRCT2::Ui::Windows