From 911db3feb17c30791661ceda5485168fee25ea16 Mon Sep 17 00:00:00 2001 From: Bob Date: Sun, 26 Sep 2010 16:46:22 +1200 Subject: [PATCH] remove setters on Mobile.{from,to}Cell. use SetLocation instead --- OpenRA.Game/Traits/Activities/Move.cs | 9 ++++----- OpenRA.Game/Traits/Mobile.cs | 4 +--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/OpenRA.Game/Traits/Activities/Move.cs b/OpenRA.Game/Traits/Activities/Move.cs index fe3f0f10c3..c8ae9be1b0 100755 --- a/OpenRA.Game/Traits/Activities/Move.cs +++ b/OpenRA.Game/Traits/Activities/Move.cs @@ -156,7 +156,7 @@ namespace OpenRA.Traits.Activities } else { - mobile.toCell = nextCell.Value; + mobile.SetLocation( mobile.fromCell, nextCell.Value ); var move = new MoveFirstHalf( this, Util.CenterOfCell( mobile.fromCell ), @@ -350,8 +350,7 @@ namespace OpenRA.Traits.Activities mobile.Facing, Util.GetNearestFacing( mobile.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.Facing ) ), moveFraction - moveFractionTotal ); - mobile.fromCell = mobile.toCell; - mobile.toCell = nextCell.Value; + mobile.SetLocation( mobile.toCell, nextCell.Value ); return ret; } else @@ -364,7 +363,7 @@ namespace OpenRA.Traits.Activities mobile.Facing, mobile.Facing, moveFraction - moveFractionTotal ); - mobile.fromCell = mobile.toCell; + mobile.SetLocation( mobile.toCell, mobile.toCell ); return ret2; } } @@ -379,7 +378,7 @@ namespace OpenRA.Traits.Activities protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent ) { self.CenterLocation = Util.CenterOfCell( mobile.toCell ); - mobile.fromCell = mobile.toCell; + mobile.SetLocation( mobile.toCell, mobile.toCell ); mobile.FinishedMoving(self); return null; } diff --git a/OpenRA.Game/Traits/Mobile.cs b/OpenRA.Game/Traits/Mobile.cs index 836d6aee15..5de98f9b20 100644 --- a/OpenRA.Game/Traits/Mobile.cs +++ b/OpenRA.Game/Traits/Mobile.cs @@ -84,20 +84,18 @@ namespace OpenRA.Traits public int2 fromCell { get { return __fromCell; } - set { SetLocation( value, __toCell ); } } [Sync] public int2 toCell { get { return __toCell; } - set { SetLocation( __fromCell, value ); } } [Sync] public int PathHash; // written by Move.EvalPath, to temporarily debug this crap. - void SetLocation(int2 from, int2 to) + public void SetLocation(int2 from, int2 to) { if (fromCell == from && toCell == to) return; RemoveInfluence();