diff --git a/Source/Game/AI/SmartScripts/SmartAIManager.cs b/Source/Game/AI/SmartScripts/SmartAIManager.cs index ce7ae086e..65bc7ac04 100644 --- a/Source/Game/AI/SmartScripts/SmartAIManager.cs +++ b/Source/Game/AI/SmartScripts/SmartAIManager.cs @@ -352,7 +352,9 @@ namespace Game.AI float x = result.Read(2); float y = result.Read(3); float z = result.Read(4); - float o = result.Read(5); + float? o = null; + if (!result.IsNull(5)) + o = result.Read(5); uint delay = result.Read(6); if (lastEntry != entry) diff --git a/Source/Game/Movement/Generators/WaypointMovement.cs b/Source/Game/Movement/Generators/WaypointMovement.cs index aa67507b3..f95e563d1 100644 --- a/Source/Game/Movement/Generators/WaypointMovement.cs +++ b/Source/Game/Movement/Generators/WaypointMovement.cs @@ -351,9 +351,8 @@ namespace Game.Movement //! but formationDest contains global coordinates init.MoveTo(waypoint.x, waypoint.y, waypoint.z); - //! Accepts angles such as 0.00001 and -0.00001, 0 must be ignored, default value in waypoint table - if (waypoint.orientation != 0 && waypoint.delay != 0) - init.SetFacing(waypoint.orientation); + if (waypoint.orientation.HasValue && waypoint.delay != 0) + init.SetFacing(waypoint.orientation.Value); switch (waypoint.moveType) { diff --git a/Source/Game/Movement/WaypointManager.cs b/Source/Game/Movement/WaypointManager.cs index b02ed374f..aaebb5ea7 100644 --- a/Source/Game/Movement/WaypointManager.cs +++ b/Source/Game/Movement/WaypointManager.cs @@ -47,7 +47,9 @@ namespace Game float x = result.Read(2); float y = result.Read(3); float z = result.Read(4); - float o = result.Read(5); + float? o = null; + if (!result.IsNull(5)) + o = result.Read(5); GridDefines.NormalizeMapCoord(ref x); GridDefines.NormalizeMapCoord(ref y); @@ -100,7 +102,9 @@ namespace Game float x = result.Read(1); float y = result.Read(2); float z = result.Read(3); - float o = result.Read(4); + float? o = null; + if (!result.IsNull(4)) + o = result.Read(4); GridDefines.NormalizeMapCoord(ref x); GridDefines.NormalizeMapCoord(ref y); @@ -141,7 +145,7 @@ namespace Game public class WaypointNode { public WaypointNode() { moveType = WaypointMoveType.Run; } - public WaypointNode(uint _id, float _x, float _y, float _z, float _orientation = 0.0f, uint _delay = 0) + public WaypointNode(uint _id, float _x, float _y, float _z, float? _orientation = null, uint _delay = 0) { id = _id; x = _x; @@ -155,7 +159,8 @@ namespace Game } public uint id; - public float x, y, z, orientation; + public float x, y, z; + public float? orientation; public uint delay; public uint eventId; public WaypointMoveType moveType; diff --git a/Source/Game/Scripting/ScriptManager.cs b/Source/Game/Scripting/ScriptManager.cs index e82073ed9..7d63d0a6f 100644 --- a/Source/Game/Scripting/ScriptManager.cs +++ b/Source/Game/Scripting/ScriptManager.cs @@ -246,7 +246,7 @@ namespace Game.Scripting WaypointPath path = _waypointStore[entry]; path.id = entry; - path.nodes.Add(new WaypointNode(id, x, y, z, 0.0f, waitTime)); + path.nodes.Add(new WaypointNode(id, x, y, z, null, waitTime)); ++count; }