mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-06 06:32:56 +01:00
Fix flaw in BringToFront using the wrong iterator, ignore dead ones
This commit is contained in:
@@ -1321,14 +1321,22 @@ public:
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
auto& w2 = *it;
|
||||
if (w2->flags & WF_DEAD)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (!(w2->flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
itDestPos = it.base();
|
||||
// base() returns the next element in the list, so we need to decrement it.
|
||||
itDestPos = std::prev(it.base());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
std::iter_swap(itSourcePos, itDestPos);
|
||||
if (itSourcePos != itDestPos)
|
||||
{
|
||||
std::iter_swap(itSourcePos, itDestPos);
|
||||
}
|
||||
w.Invalidate();
|
||||
|
||||
if (w.windowPos.x + w.width < 20)
|
||||
|
||||
Reference in New Issue
Block a user