Remove some bogus duplication in Sell (caused the double-sell bug).

This commit is contained in:
Paul Chote
2011-04-16 11:26:51 +12:00
parent 7b0a9136ab
commit 8b00e1cfa5
3 changed files with 9 additions and 17 deletions

View File

@@ -37,8 +37,10 @@ namespace OpenRA.Mods.RA.Activities
started = true; started = true;
if (Reversed) if (Reversed)
{ {
foreach (var s in self.Info.Traits.Get<BuildingInfo>().SellSounds) var bi = self.Info.Traits.GetOrDefault<BuildingInfo>();
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation); if (bi != null)
foreach (var s in bi.SellSounds)
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);
// PlayCustomAnim is required to stop a frame of the normal state after the anim completes // PlayCustomAnim is required to stop a frame of the normal state after the anim completes
rb.PlayCustomAnimBackwards(self, "make", () => {rb.PlayCustomAnim(self, "make"); complete = true;}); rb.PlayCustomAnimBackwards(self, "make", () => {rb.PlayCustomAnim(self, "make"); complete = true;});

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.RA.Render
} }
} }
public class RenderBuilding : RenderSimple, INotifyDamage, INotifySold, IRenderModifier public class RenderBuilding : RenderSimple, INotifyDamage, IRenderModifier
{ {
readonly RenderBuildingInfo Info; readonly RenderBuildingInfo Info;
@@ -112,16 +112,5 @@ namespace OpenRA.Mods.RA.Render
else if (e.DamageState < DamageState.Heavy) else if (e.DamageState < DamageState.Heavy)
anim.ReplaceAnim("idle"); anim.ReplaceAnim("idle");
} }
public virtual void Selling( Actor self )
{
if( Info.HasMakeAnimation )
anim.PlayBackwardsThen( "make", null );
foreach (var s in self.Info.Traits.Get<BuildingInfo>().SellSounds)
Sound.PlayToPlayer(self.Owner, s, self.CenterLocation);
}
public void Sold(Actor self) {}
} }
} }

View File

@@ -87,10 +87,11 @@ namespace OpenRA.Mods.RA.Render
roof.PlayThen(NormalizeSequence(self, "build-top"), () => { isOpen = true; openExit = exit; }); roof.PlayThen(NormalizeSequence(self, "build-top"), () => { isOpen = true; openExit = exit; });
} }
public override void Selling( Actor self ) public void Selling(Actor self)
{ {
self.Trait<RenderSimple>().anims.Remove( "roof" ); self.Trait<RenderSimple>().anims.Remove("roof");
base.Selling(self);
} }
public void Sold(Actor self) { }
} }
} }