From 89d906a6136201d2d709624bbf942d96499649d9 Mon Sep 17 00:00:00 2001 From: michaeldgg2 <119738087+michaeldgg2@users.noreply.github.com> Date: Thu, 17 Apr 2025 11:49:16 +0200 Subject: [PATCH] ProductionTabsWidget: fix updating internal cache for production queue --- OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs index fbad20ee1a..85f40a2408 100644 --- a/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs +++ b/OpenRA.Mods.Common/Widgets/ProductionTabsWidget.cs @@ -278,12 +278,16 @@ namespace OpenRA.Mods.Common.Widgets // It is possible that production queues get enabled/disabled during their lifetime. // This makes sure every enabled production queue always has its tab associated with it. var shouldUpdateQueues = false; - foreach (var (queue, enabled) in cachedProductionQueueEnabledStates) + for (var i = 0; i < cachedProductionQueueEnabledStates.Count; i++) { + var (queue, enabled) = cachedProductionQueueEnabledStates[i]; + if (queue.Enabled != enabled) { shouldUpdateQueues = true; - break; + + // Refresh queue.Enabled value in cache + cachedProductionQueueEnabledStates[i] = (queue, queue.Enabled); } }