Merge pull request #11165 from pchote/fix-missile-flip

Fix missile facing check.
This commit is contained in:
reaperrr
2016-04-23 15:15:59 +02:00

View File

@@ -9,6 +9,7 @@
*/ */
#endregion #endregion
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
using System.Linq; using System.Linq;
@@ -711,9 +712,9 @@ namespace OpenRA.Mods.Common.Effects
var velVec = tarDistVec + predVel; var velVec = tarDistVec + predVel;
var desiredHFacing = velVec.HorizontalLengthSquared != 0 ? velVec.Yaw.Facing : hFacing; var desiredHFacing = velVec.HorizontalLengthSquared != 0 ? velVec.Yaw.Facing : hFacing;
if (allowPassBy && System.Math.Abs(desiredHFacing - hFacing) >= System.Math.Abs(desiredHFacing + 128 - hFacing)) if (allowPassBy && Math.Abs((desiredHFacing - hFacing) & 0xFF) >= Math.Abs((desiredHFacing + 128 - hFacing) & 0xFF))
{ {
desiredHFacing += 128; desiredHFacing = (desiredHFacing + 128) & 0xFF;
targetPassedBy = true; targetPassedBy = true;
} }
else else