@@ -101,8 +101,18 @@ public enum ReadyTextStyleOptions { Solid, AlternatingColor, Blinking }
101
101
102
102
public ProductionQueue CurrentQueue
103
103
{
104
- get { return currentQueue ; }
105
- set { currentQueue = value ; RefreshIcons ( ) ; }
104
+ get
105
+ {
106
+ return currentQueue ;
107
+ }
108
+ set
109
+ {
110
+ currentQueue = value ;
111
+ if ( currentQueue != null )
112
+ UpdateCachedProductionIconOverlays ( ) ;
113
+
114
+ RefreshIcons ( ) ;
115
+ }
106
116
}
107
117
108
118
public override Rectangle EventBounds { get { return eventBounds ; } }
@@ -115,6 +125,9 @@ public ProductionQueue CurrentQueue
115
125
SpriteFont overlayFont , symbolFont ;
116
126
float2 iconOffset , holdOffset , readyOffset , timeOffset , queuedOffset , infiniteOffset ;
117
127
128
+ Player cachedQueueOwner ;
129
+ IProductionIconOverlay [ ] pios ;
130
+
118
131
[ CustomLintableHotkeyNames ]
119
132
public static IEnumerable < string > LinterHotkeyNames ( MiniYamlNode widgetNode , Action < string > emitError , Action < string > emitWarning )
120
133
{
@@ -225,7 +238,12 @@ public override void Tick()
225
238
CurrentQueue = null ;
226
239
227
240
if ( CurrentQueue != null )
241
+ {
242
+ if ( CurrentQueue . Actor . Owner != cachedQueueOwner )
243
+ UpdateCachedProductionIconOverlays ( ) ;
244
+
228
245
RefreshIcons ( ) ;
246
+ }
229
247
}
230
248
231
249
public override void MouseEntered ( )
@@ -413,6 +431,12 @@ bool SelectProductionBuilding()
413
431
return true ;
414
432
}
415
433
434
+ void UpdateCachedProductionIconOverlays ( )
435
+ {
436
+ cachedQueueOwner = CurrentQueue . Actor . Owner ;
437
+ pios = cachedQueueOwner . PlayerActor . TraitsImplementing < IProductionIconOverlay > ( ) . ToArray ( ) ;
438
+ }
439
+
416
440
public void RefreshIcons ( )
417
441
{
418
442
icons = new Dictionary < Rectangle , ProductionIcon > ( ) ;
@@ -480,8 +504,6 @@ public override void Draw()
480
504
481
505
var buildableItems = CurrentQueue . BuildableItems ( ) ;
482
506
483
- var pios = currentQueue . Actor . Owner . PlayerActor . TraitsImplementing < IProductionIconOverlay > ( ) ;
484
-
485
507
// Icons
486
508
Game . Renderer . EnableAntialiasingFilter ( ) ;
487
509
foreach ( var icon in icons . Values )
0 commit comments