Fixed bug where unit would occasionally "disappear" or face in an odd direction.
This commit is contained in:
@@ -26,7 +26,7 @@ namespace OpenRa.Game.GameRules
|
|||||||
return float.Parse(x.Replace("%","")) * (x.Contains( '%' ) ? 0.01f : 1f);
|
return float.Parse(x.Replace("%","")) * (x.Contains( '%' ) ? 0.01f : 1f);
|
||||||
|
|
||||||
else if (fieldType == typeof(string))
|
else if (fieldType == typeof(string))
|
||||||
return x;//.ToLowerInvariant();
|
return x;
|
||||||
|
|
||||||
else if (fieldType.IsEnum)
|
else if (fieldType.IsEnum)
|
||||||
return Enum.Parse(fieldType, x);
|
return Enum.Parse(fieldType, x);
|
||||||
|
|||||||
@@ -168,7 +168,6 @@ namespace OpenRa.Game.Traits
|
|||||||
{
|
{
|
||||||
moveFraction -= moveFractionTotal;
|
moveFraction -= moveFractionTotal;
|
||||||
OnComplete( self, mobile );
|
OnComplete( self, mobile );
|
||||||
//mobile.fromCell = mobile.toCell;
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -177,7 +176,7 @@ namespace OpenRa.Game.Traits
|
|||||||
{
|
{
|
||||||
self.CenterLocation = float2.Lerp( from, to, frac );
|
self.CenterLocation = float2.Lerp( from, to, frac );
|
||||||
if( moveFraction >= moveFractionTotal )
|
if( moveFraction >= moveFractionTotal )
|
||||||
mobile.facing = toFacing;
|
mobile.facing = toFacing & 0xFF;
|
||||||
else
|
else
|
||||||
mobile.facing = ( fromFacing + ( toFacing - fromFacing ) * moveFraction / moveFractionTotal ) & 0xFF;
|
mobile.facing = ( fromFacing + ( toFacing - fromFacing ) * moveFraction / moveFractionTotal ) & 0xFF;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ namespace OpenRa.Game.Traits
|
|||||||
var leftTurn = ( facing - desiredFacing ) & 0xFF;
|
var leftTurn = ( facing - desiredFacing ) & 0xFF;
|
||||||
var rightTurn = ( desiredFacing - facing ) & 0xFF;
|
var rightTurn = ( desiredFacing - facing ) & 0xFF;
|
||||||
if( Math.Min( leftTurn, rightTurn ) < rot )
|
if( Math.Min( leftTurn, rightTurn ) < rot )
|
||||||
facing = desiredFacing;
|
facing = desiredFacing & 0xFF;
|
||||||
else if( rightTurn < leftTurn )
|
else if( rightTurn < leftTurn )
|
||||||
facing = ( facing + rot ) & 0xFF;
|
facing = ( facing + rot ) & 0xFF;
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user