a bit of cleanup

This commit is contained in:
Chris Forbes
2010-06-12 21:48:52 +12:00
parent 02350e6ac8
commit bcf7328d77

View File

@@ -42,15 +42,16 @@ namespace OpenRA.Traits
if (producing == null || producing.Item != order.TargetString || producing.RemainingTime != 0)
return;
var buildingInfo = unit.Traits.Get<BuildingInfo>();
if (order.OrderString == "LineBuild")
{
bool playSounds = true;
var buildingInfo = unit.Traits.Get<BuildingInfo>();
foreach (var t in LineBuildUtils.GetLineBuildCells(w, order.TargetLocation, order.TargetString, buildingInfo))
{
var building = w.CreateActor(order.TargetString, t, order.Player);
if (playSounds)
foreach( var s in building.Info.Traits.Get<BuildingInfo>().BuildSounds )
foreach (var s in buildingInfo.BuildSounds)
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
playSounds = false;
}
@@ -58,7 +59,7 @@ namespace OpenRA.Traits
else
{
var building = w.CreateActor(order.TargetString, order.TargetLocation, order.Player);
foreach (var s in building.Info.Traits.Get<BuildingInfo>().BuildSounds)
foreach (var s in buildingInfo.BuildSounds)
Sound.PlayToPlayer(order.Player, s, building.CenterLocation);
}