Revert "remove setters on Mobile.{from,to}Cell. use SetLocation instead"

This reverts commit 911db3feb1.
This commit is contained in:
Chris Forbes
2010-09-28 07:45:14 +13:00
parent f402ec7898
commit 47950c9113
2 changed files with 8 additions and 5 deletions

View File

@@ -156,7 +156,7 @@ namespace OpenRA.Traits.Activities
} }
else else
{ {
mobile.SetLocation( mobile.fromCell, nextCell.Value ); mobile.toCell = nextCell.Value;
var move = new MoveFirstHalf( var move = new MoveFirstHalf(
this, this,
Util.CenterOfCell( mobile.fromCell ), Util.CenterOfCell( mobile.fromCell ),
@@ -350,7 +350,8 @@ namespace OpenRA.Traits.Activities
mobile.Facing, mobile.Facing,
Util.GetNearestFacing( mobile.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.Facing ) ), Util.GetNearestFacing( mobile.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.Facing ) ),
moveFraction - moveFractionTotal ); moveFraction - moveFractionTotal );
mobile.SetLocation( mobile.toCell, nextCell.Value ); mobile.fromCell = mobile.toCell;
mobile.toCell = nextCell.Value;
return ret; return ret;
} }
else else
@@ -363,7 +364,7 @@ namespace OpenRA.Traits.Activities
mobile.Facing, mobile.Facing,
mobile.Facing, mobile.Facing,
moveFraction - moveFractionTotal ); moveFraction - moveFractionTotal );
mobile.SetLocation( mobile.toCell, mobile.toCell ); mobile.fromCell = mobile.toCell;
return ret2; return ret2;
} }
} }
@@ -378,7 +379,7 @@ namespace OpenRA.Traits.Activities
protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent ) protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent )
{ {
self.CenterLocation = Util.CenterOfCell( mobile.toCell ); self.CenterLocation = Util.CenterOfCell( mobile.toCell );
mobile.SetLocation( mobile.toCell, mobile.toCell ); mobile.fromCell = mobile.toCell;
mobile.FinishedMoving(self); mobile.FinishedMoving(self);
return null; return null;
} }

View File

@@ -84,18 +84,20 @@ namespace OpenRA.Traits
public int2 fromCell public int2 fromCell
{ {
get { return __fromCell; } get { return __fromCell; }
set { SetLocation( value, __toCell ); }
} }
[Sync] [Sync]
public int2 toCell public int2 toCell
{ {
get { return __toCell; } get { return __toCell; }
set { SetLocation( __fromCell, value ); }
} }
[Sync] [Sync]
public int PathHash; // written by Move.EvalPath, to temporarily debug this crap. public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
public void SetLocation(int2 from, int2 to) void SetLocation(int2 from, int2 to)
{ {
if (fromCell == from && toCell == to) return; if (fromCell == from && toCell == to) return;
RemoveInfluence(); RemoveInfluence();