Skip to content

Commit 47950c9

Browse files
committed
Revert "remove setters on Mobile.{from,to}Cell. use SetLocation instead"
This reverts commit 911db3f.
1 parent f402ec7 commit 47950c9

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

OpenRA.Game/Traits/Activities/Move.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public override IActivity Tick( Actor self )
156156
}
157157
else
158158
{
159-
mobile.SetLocation( mobile.fromCell, nextCell.Value );
159+
mobile.toCell = nextCell.Value;
160160
var move = new MoveFirstHalf(
161161
this,
162162
Util.CenterOfCell( mobile.fromCell ),
@@ -350,7 +350,8 @@ protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent )
350350
mobile.Facing,
351351
Util.GetNearestFacing( mobile.Facing, Util.GetFacing( nextCell.Value - mobile.toCell, mobile.Facing ) ),
352352
moveFraction - moveFractionTotal );
353-
mobile.SetLocation( mobile.toCell, nextCell.Value );
353+
mobile.fromCell = mobile.toCell;
354+
mobile.toCell = nextCell.Value;
354355
return ret;
355356
}
356357
else
@@ -363,7 +364,7 @@ protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent )
363364
mobile.Facing,
364365
mobile.Facing,
365366
moveFraction - moveFractionTotal );
366-
mobile.SetLocation( mobile.toCell, mobile.toCell );
367+
mobile.fromCell = mobile.toCell;
367368
return ret2;
368369
}
369370
}
@@ -378,7 +379,7 @@ public MoveSecondHalf( Move move, float2 from, float2 to, int fromFacing, int to
378379
protected override MovePart OnComplete( Actor self, Mobile mobile, Move parent )
379380
{
380381
self.CenterLocation = Util.CenterOfCell( mobile.toCell );
381-
mobile.SetLocation( mobile.toCell, mobile.toCell );
382+
mobile.fromCell = mobile.toCell;
382383
mobile.FinishedMoving(self);
383384
return null;
384385
}

OpenRA.Game/Traits/Mobile.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,20 @@ public int Altitude
8484
public int2 fromCell
8585
{
8686
get { return __fromCell; }
87+
set { SetLocation( value, __toCell ); }
8788
}
8889

8990
[Sync]
9091
public int2 toCell
9192
{
9293
get { return __toCell; }
94+
set { SetLocation( __fromCell, value ); }
9395
}
9496

9597
[Sync]
9698
public int PathHash; // written by Move.EvalPath, to temporarily debug this crap.
9799

98-
public void SetLocation(int2 from, int2 to)
100+
void SetLocation(int2 from, int2 to)
99101
{
100102
if (fromCell == from && toCell == to) return;
101103
RemoveInfluence();

0 commit comments

Comments
 (0)