From 9e0c4f65dbad72c529d69fe4ef166699fc43d86a Mon Sep 17 00:00:00 2001 From: glax Date: Wed, 19 Apr 2023 22:02:15 +0200 Subject: [PATCH] appropriate names in PathResult for nodes gSCoreNodes --- Pathfinding/PathResult.cs | 10 +++++----- Pathfinding/Pathfinder.cs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Pathfinding/PathResult.cs b/Pathfinding/PathResult.cs index 5a0f788..be2a365 100644 --- a/Pathfinding/PathResult.cs +++ b/Pathfinding/PathResult.cs @@ -8,16 +8,16 @@ public class PathResult [JsonInclude]public TimeSpan calcTime; [JsonInclude]public List pathNodes; [JsonInclude]public Dictionary? gScore; - [JsonInclude]public HashSet? nodes; + [JsonInclude]public HashSet? gScoreNodes; public string? name { get; set; } [JsonConstructor] - public PathResult(TimeSpan calcTime, List pathNodes, Dictionary? gScore, HashSet? nodes) + public PathResult(TimeSpan calcTime, List pathNodes, Dictionary? gScore, HashSet? gScoreNodes) { this.calcTime = calcTime; this.pathNodes = pathNodes; this.gScore = gScore; - this.nodes = nodes; + this.gScoreNodes = gScoreNodes; } public PathResult(TimeSpan calcTime, List pathNodes) @@ -36,11 +36,11 @@ public class PathResult public void AddGScores(Dictionary gScore) { this.gScore = new(); - this.nodes = new(); + this.gScoreNodes = new(); foreach (KeyValuePair kv in gScore) { this.gScore.Add(kv.Key.nodeId, kv.Value); - this.nodes.Add(kv.Key); + this.gScoreNodes.Add(kv.Key); } } } \ No newline at end of file diff --git a/Pathfinding/Pathfinder.cs b/Pathfinding/Pathfinder.cs index a8724e4..865ded8 100644 --- a/Pathfinding/Pathfinder.cs +++ b/Pathfinding/Pathfinder.cs @@ -33,10 +33,10 @@ public static class Pathfinder { Console.WriteLine("Path found."); PathResult path = GetPath(cameFromDict, goalNode, regionManager, DateTime.Now - startCalc); - path.AddGScores(gScore); string fileName = $"{new DirectoryInfo(workingDir).Name}-{DateTime.Now.ToFileTime()}.result"; string outputFilepath = Path.Join(Directory.GetParent(workingDir)!.FullName, fileName); path.name = outputFilepath; + path.AddGScores(gScore); SaveGraph(path, outputFilepath); return path; }