Pull out a temporary variable in ProductionQueue.

This commit is contained in:
Paul Chote
2015-09-20 20:08:05 +01:00
parent d112083c44
commit 7f4663f606

View File

@@ -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<BuildableInfo>();
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<BuildingInfo>();
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);
}
})));
}