forked from rosebudai/OpenRCT2-Web
Rename g_window_list to gWindowList
This commit is contained in:
8 files changed
+46
-46
No files matched your search
@@ -320,7 +320,7 @@ public:
|
||||
int32_t top = rt.y;
|
||||
int32_t bottom = top + rt.height;
|
||||
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
DrawWeatherWindow(rt, weatherDrawer, w.get(), left, right, top, bottom, drawFunc);
|
||||
}
|
||||
@@ -958,7 +958,7 @@ private:
|
||||
auto itStart = WindowGetIterator(original_w);
|
||||
for (auto it = std::next(itStart);; it++)
|
||||
{
|
||||
if (it == g_window_list.end())
|
||||
if (it == gWindowList.end())
|
||||
{
|
||||
// Loop ended, draw weather for original_w
|
||||
auto vp = original_w->viewport;
|
||||
|
||||
@@ -651,7 +651,7 @@ public:
|
||||
|
||||
WindowBase* GetOwner(const Viewport* viewport) override
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->viewport == viewport)
|
||||
{
|
||||
@@ -663,7 +663,7 @@ public:
|
||||
|
||||
static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, const ScreenSize windowSize)
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -757,7 +757,7 @@ public:
|
||||
}
|
||||
|
||||
// Place window next to another
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -786,7 +786,7 @@ public:
|
||||
}
|
||||
|
||||
// Overlap
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -812,7 +812,7 @@ public:
|
||||
|
||||
// Cascade
|
||||
auto screenPos = ScreenCoordsXY{ 0, 30 };
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (screenPos == w->windowPos)
|
||||
{
|
||||
@@ -855,10 +855,10 @@ public:
|
||||
|
||||
// Check if there are any window slots left
|
||||
// include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
|
||||
if (g_window_list.size() >= static_cast<size_t>(Config::Get().general.WindowLimit + kWindowLimitReserved))
|
||||
if (gWindowList.size() >= static_cast<size_t>(Config::Get().general.WindowLimit + kWindowLimitReserved))
|
||||
{
|
||||
// Close least recently used window
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -871,10 +871,10 @@ public:
|
||||
}
|
||||
|
||||
// Find right position to insert new window
|
||||
auto itDestPos = g_window_list.end();
|
||||
auto itDestPos = gWindowList.end();
|
||||
if (flags & WF_STICK_TO_BACK)
|
||||
{
|
||||
for (auto it = g_window_list.begin(); it != g_window_list.end(); it++)
|
||||
for (auto it = gWindowList.begin(); it != gWindowList.end(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -886,7 +886,7 @@ public:
|
||||
}
|
||||
else if (!(flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -923,7 +923,7 @@ public:
|
||||
wp->invalidate();
|
||||
wp->onOpen();
|
||||
|
||||
auto itNew = g_window_list.insert(itDestPos, std::move(wp));
|
||||
auto itNew = gWindowList.insert(itDestPos, std::move(wp));
|
||||
return itNew->get();
|
||||
}
|
||||
|
||||
@@ -953,14 +953,14 @@ public:
|
||||
void CloseSurplus(int32_t cap, WindowClass avoid_classification) override
|
||||
{
|
||||
// find the amount of windows that are currently open
|
||||
auto count = static_cast<int32_t>(g_window_list.size());
|
||||
auto count = static_cast<int32_t>(gWindowList.size());
|
||||
// difference between amount open and cap = amount to close
|
||||
auto diff = count - kWindowLimitReserved - cap;
|
||||
for (auto i = 0; i < diff; i++)
|
||||
{
|
||||
// iterates through the list until it finds the newest window, or a window that can be closed
|
||||
WindowBase* foundW{};
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -988,7 +988,7 @@ public:
|
||||
// when Close() might trigger window creation via OnClose()
|
||||
std::vector<WindowBase*> windowsToClose;
|
||||
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); ++it)
|
||||
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); ++it)
|
||||
{
|
||||
auto& wnd = *(*it);
|
||||
if (wnd.flags & WF_DEAD)
|
||||
@@ -1114,7 +1114,7 @@ public:
|
||||
*/
|
||||
WindowBase* FindByClass(WindowClass cls) override
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -1133,7 +1133,7 @@ public:
|
||||
*/
|
||||
WindowBase* FindByNumber(WindowClass cls, WindowNumber number) override
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -1157,7 +1157,7 @@ public:
|
||||
*/
|
||||
WindowBase* FindFromPoint(const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++)
|
||||
{
|
||||
auto& w = *it;
|
||||
if (w->flags & WF_DEAD)
|
||||
@@ -1327,11 +1327,11 @@ public:
|
||||
if (!(w.flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
auto itSourcePos = WindowGetIterator(&w);
|
||||
if (itSourcePos != g_window_list.end())
|
||||
if (itSourcePos != gWindowList.end())
|
||||
{
|
||||
// Insert in front of the first non-stick-to-front window
|
||||
auto itDestPos = g_window_list.begin();
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
auto itDestPos = gWindowList.begin();
|
||||
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++)
|
||||
{
|
||||
auto& w2 = *it;
|
||||
if (w2->flags & WF_DEAD)
|
||||
|
||||
@@ -529,7 +529,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
WindowBase* WindowGetListening()
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++)
|
||||
{
|
||||
auto& w = **it;
|
||||
if (w.flags & WF_DEAD)
|
||||
|
||||
@@ -1348,7 +1348,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
WindowBase* FindCustomWindowByClassification(std::string_view classification)
|
||||
{
|
||||
for (const auto& w : g_window_list)
|
||||
for (const auto& w : gWindowList)
|
||||
{
|
||||
if (w->classification == WindowClass::Custom)
|
||||
{
|
||||
@@ -1481,7 +1481,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
// Get all the windows that need closing
|
||||
std::vector<WindowBase*> customWindows;
|
||||
for (const auto& window : g_window_list)
|
||||
for (const auto& window : gWindowList)
|
||||
{
|
||||
if (window->classification == WindowClass::Custom)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenRCT2::Scripting
|
||||
}
|
||||
int32_t windows_get() const
|
||||
{
|
||||
return static_cast<int32_t>(g_window_list.size());
|
||||
return static_cast<int32_t>(gWindowList.size());
|
||||
}
|
||||
|
||||
std::shared_ptr<ScViewport> mainViewport_get() const
|
||||
@@ -214,7 +214,7 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
auto index = a.as_uint();
|
||||
size_t i = 0;
|
||||
for (const auto& w : g_window_list)
|
||||
for (const auto& w : gWindowList)
|
||||
{
|
||||
if (i == index)
|
||||
{
|
||||
|
||||
@@ -340,14 +340,14 @@ namespace OpenRCT2
|
||||
// Get next valid window after.
|
||||
auto itNextWindow = [&]() {
|
||||
auto itNext = std::next(itWindowPos);
|
||||
while (itNext != g_window_list.end() && (itNext->get()->flags & WF_DEAD))
|
||||
while (itNext != gWindowList.end() && (itNext->get()->flags & WF_DEAD))
|
||||
{
|
||||
++itNext;
|
||||
}
|
||||
return itNext;
|
||||
}();
|
||||
ViewportRedrawAfterShift(
|
||||
rt, itNextWindow == g_window_list.end() ? nullptr : itNextWindow->get(), originalWindow, shift, drawRect);
|
||||
rt, itNextWindow == gWindowList.end() ? nullptr : itNextWindow->get(), originalWindow, shift, drawRect);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -439,7 +439,7 @@ namespace OpenRCT2
|
||||
{
|
||||
// This loop redraws all parts covered by transparent windows.
|
||||
auto it = WindowGetIterator(window);
|
||||
for (; it != g_window_list.end(); it++)
|
||||
for (; it != gWindowList.end(); it++)
|
||||
{
|
||||
auto w = it->get();
|
||||
if (!(w->flags & WF_TRANSPARENT) || (w->flags & WF_DEAD))
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
namespace OpenRCT2
|
||||
{
|
||||
|
||||
std::vector<std::unique_ptr<WindowBase>> g_window_list;
|
||||
std::vector<std::unique_ptr<WindowBase>> gWindowList;
|
||||
WindowBase* gWindowAudioExclusive;
|
||||
|
||||
WindowCloseModifier gLastCloseModifier = { { WindowClass::Null, 0 }, CloseWindowModifier::none };
|
||||
@@ -78,12 +78,12 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
|
||||
std::vector<std::unique_ptr<WindowBase>>::iterator WindowGetIterator(const WindowBase* w)
|
||||
{
|
||||
return std::find_if(g_window_list.begin(), g_window_list.end(), [w](auto&& w2) { return w == w2.get(); });
|
||||
return std::find_if(gWindowList.begin(), gWindowList.end(), [w](auto&& w2) { return w == w2.get(); });
|
||||
}
|
||||
|
||||
void WindowVisitEach(std::function<void(WindowBase*)> func)
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -126,8 +126,8 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
|
||||
static void WindowUpdateVisibilities()
|
||||
{
|
||||
const auto itEnd = g_window_list.end();
|
||||
for (auto it = g_window_list.begin(); it != itEnd; ++it)
|
||||
const auto itEnd = gWindowList.end();
|
||||
for (auto it = gWindowList.begin(); it != itEnd; ++it)
|
||||
{
|
||||
auto& window = *(*it);
|
||||
if (window.viewport == nullptr)
|
||||
@@ -167,10 +167,10 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
*/
|
||||
void WindowUpdateAll()
|
||||
{
|
||||
// Remove all windows in g_window_list that have the WF_DEAD flag
|
||||
g_window_list.erase(
|
||||
std::remove_if(g_window_list.begin(), g_window_list.end(), [](auto&& w) -> bool { return w->flags & WF_DEAD; }),
|
||||
g_window_list.end());
|
||||
// Remove all windows in gWindowList that have the WF_DEAD flag
|
||||
gWindowList.erase(
|
||||
std::remove_if(gWindowList.begin(), gWindowList.end(), [](auto&& w) -> bool { return w->flags & WF_DEAD; }),
|
||||
gWindowList.end());
|
||||
|
||||
// Periodic update happens every second so 40 ticks.
|
||||
if (gCurrentRealTimeTicks >= gWindowUpdateTicks)
|
||||
@@ -310,7 +310,7 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
*/
|
||||
WindowBase* WindowGetMain()
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
for (auto& w : gWindowList)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -369,7 +369,7 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
auto y2 = w.viewport->pos.y + static_cast<int32_t>(w.viewport->height * kWindowScrollLocations[i][1]);
|
||||
|
||||
auto it = WindowGetIterator(&w);
|
||||
for (; it != g_window_list.end(); it++)
|
||||
for (; it != gWindowList.end(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
@@ -388,7 +388,7 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (it == g_window_list.end())
|
||||
if (it == gWindowList.end())
|
||||
{
|
||||
found = true;
|
||||
}
|
||||
@@ -492,7 +492,7 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
|
||||
// Divide the draws up for only the visible regions of the window recursively
|
||||
auto itPos = WindowGetIterator(&w);
|
||||
for (auto it = std::next(itPos); it != g_window_list.end(); it++)
|
||||
for (auto it = std::next(itPos); it != gWindowList.end(); it++)
|
||||
{
|
||||
// Check if this window overlaps w
|
||||
auto topwindow = it->get();
|
||||
@@ -555,7 +555,7 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
return;
|
||||
|
||||
// Draw the window and any other overlapping transparent windows
|
||||
for (auto it = WindowGetIterator(&w); it != g_window_list.end(); it++)
|
||||
for (auto it = WindowGetIterator(&w); it != gWindowList.end(); it++)
|
||||
{
|
||||
auto* v = (*it).get();
|
||||
if (v->flags & WF_DEAD)
|
||||
@@ -815,7 +815,7 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
RideAudio::ClearAllViewportInstances();
|
||||
gMusicTrackingViewport = nullptr;
|
||||
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
for (auto it = gWindowList.rbegin(); it != gWindowList.rend(); it++)
|
||||
{
|
||||
auto w = it->get();
|
||||
auto viewport = w->viewport;
|
||||
|
||||
@@ -237,5 +237,5 @@ namespace OpenRCT2
|
||||
#endif
|
||||
|
||||
// rct2: 0x01420078
|
||||
extern std::vector<std::unique_ptr<WindowBase>> g_window_list;
|
||||
extern std::vector<std::unique_ptr<WindowBase>> gWindowList;
|
||||
} // namespace OpenRCT2
|
||||
Reference in new issue
Block a user