Fixed bug where units left influence behind in some circumstances.

This commit is contained in:
Bob
2009-10-26 22:08:12 +13:00
parent 48a4e421d8
commit 65f7f8c145

View File

@@ -249,21 +249,21 @@ namespace OpenRa.Game.Traits
var nextCell = parent.path[ parent.path.Count - 1 ]; var nextCell = parent.path[ parent.path.Count - 1 ];
if( ( nextCell - mobile.toCell ) != ( mobile.toCell - mobile.fromCell ) ) if( ( nextCell - mobile.toCell ) != ( mobile.toCell - mobile.fromCell ) )
{ {
if( !CanEnterCell( nextCell, self ) ) if( CanEnterCell( nextCell, self ) )
return null; {
parent.path.RemoveAt( parent.path.Count - 1 );
parent.path.RemoveAt( parent.path.Count - 1 ); var ret = new MoveFirstHalf(
BetweenCells( mobile.fromCell, mobile.toCell ),
var ret = new MoveFirstHalf( BetweenCells( mobile.toCell, nextCell ),
BetweenCells( mobile.fromCell, mobile.toCell ), mobile.facing,
BetweenCells( mobile.toCell, nextCell ), Util.GetNearestFacing( mobile.facing, Util.GetFacing( nextCell - mobile.toCell, mobile.facing ) ),
mobile.facing, moveFraction - moveFractionTotal );
Util.GetNearestFacing( mobile.facing, Util.GetFacing( nextCell - mobile.toCell, mobile.facing ) ), mobile.fromCell = mobile.toCell;
moveFraction - moveFractionTotal ); mobile.toCell = nextCell;
mobile.fromCell = mobile.toCell; Game.UnitInfluence.Update( mobile );
mobile.toCell = nextCell; return ret;
Game.UnitInfluence.Update( mobile ); }
return ret;
} }
} }
var ret2 = new MoveSecondHalf( var ret2 = new MoveSecondHalf(