Avoid window iterations when no windows of desired class present

This commit is contained in:
Jonathan G Rennison
2023-09-18 19:05:55 +01:00
parent 52e4688851
commit b93503bb21
5 changed files with 19 additions and 1 deletions

View File

@@ -2751,6 +2751,7 @@ void DirtyVehicleListWindowForVehicle(const Vehicle *v)
{
WindowClass cls = static_cast<WindowClass>(WC_TRAINS_LIST + v->type);
WindowClass cls2 = (v->type == VEH_TRAIN) ? WC_TRACE_RESTRICT_SLOTS : cls;
if (!HaveWindowByClass(cls) && !HaveWindowByClass(cls2)) return;
for (Window *w : Window::Iterate()) {
if (w->window_class == cls || w->window_class == cls2) {
BaseVehicleListWindow *listwin = static_cast<BaseVehicleListWindow *>(w);