From 62302bfb23b39c00a3e504ee598b6c9cb1d7db10 Mon Sep 17 00:00:00 2001 From: Metal Gear Sloth Date: Thu, 9 Jul 2020 00:16:57 +1000 Subject: [PATCH] Use named tuples Thanks remie --- .../AI/Steering/AiSteeringSystem.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs index 6d9093ec83..aa18221ce0 100644 --- a/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs +++ b/Content.Server/GameObjects/EntitySystems/AI/Steering/AiSteeringSystem.cs @@ -66,7 +66,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering /// /// Pathfinding request jobs we're waiting on /// - private readonly Dictionary>)> _pathfindingRequests = + private readonly Dictionary> Job)> _pathfindingRequests = new Dictionary>)>(); /// @@ -135,7 +135,7 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering if (_pathfindingRequests.TryGetValue(entity, out var request)) { - switch (request.Item2.Status) + switch (request.Job.Status) { case JobStatus.Pending: case JobStatus.Finished: @@ -143,16 +143,16 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering case JobStatus.Running: case JobStatus.Paused: case JobStatus.Waiting: - request.Item1.Cancel(); + request.CancelToken.Cancel(); break; } - switch (request.Item2.Exception) + switch (request.Job.Exception) { case null: break; default: - throw request.Item2.Exception; + throw request.Job.Exception; } _pathfindingRequests.Remove(entity); } @@ -276,9 +276,9 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering // Handle pathfinding job // If we still have an existing path then keep following that until the new path arrives - if (_pathfindingRequests.TryGetValue(entity, out var pathRequest) && pathRequest.Item2.Status == JobStatus.Finished) + if (_pathfindingRequests.TryGetValue(entity, out var pathRequest) && pathRequest.Job.Status == JobStatus.Finished) { - switch (pathRequest.Item2.Exception) + switch (pathRequest.Job.Exception) { case null: break; @@ -287,10 +287,10 @@ namespace Content.Server.GameObjects.EntitySystems.AI.Steering controller.VelocityDir = Vector2.Zero; return SteeringStatus.NoPath; default: - throw pathRequest.Item2.Exception; + throw pathRequest.Job.Exception; } // No actual path - var path = _pathfindingRequests[entity].Item2.Result; + var path = _pathfindingRequests[entity].Job.Result; if (path == null || path.Count == 0) { controller.VelocityDir = Vector2.Zero;