From 7f4663f606ca51916b50932d5c9de0fbea66bc6f Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Sun, 20 Sep 2015 20:08:05 +0100 Subject: [PATCH] Pull out a temporary variable in ProductionQueue. --- OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs index 85c1a2348f..9687a6fb8b 100644 --- a/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs +++ b/OpenRA.Mods.Common/Traits/Player/ProductionQueue.cs @@ -245,11 +245,12 @@ namespace OpenRA.Mods.Common.Traits if (!Enabled) return; + var rules = self.World.Map.Rules; switch (order.OrderString) { case "StartProduction": { - var unit = self.World.Map.Rules.Actors[order.TargetString]; + var unit = rules.Actors[order.TargetString]; var bi = unit.TraitInfo(); if (!bi.Queue.Contains(Info.Type)) return; /* Not built by this queue */ @@ -281,13 +282,13 @@ namespace OpenRA.Mods.Common.Traits var isBuilding = unit.HasTraitInfo(); if (isBuilding && !hasPlayedSound) - hasPlayedSound = Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); + hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); else if (!isBuilding) { if (BuildUnit(order.TargetString)) - Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); + Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.ReadyAudio, self.Owner.Faction.InternalName); else if (!hasPlayedSound && time > 0) - hasPlayedSound = Game.Sound.PlayNotification(self.World.Map.Rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName); + hasPlayedSound = Game.Sound.PlayNotification(rules, self.Owner, "Speech", Info.BlockedAudio, self.Owner.Faction.InternalName); } }))); }