Cleanup of unnecessary code
This commit is contained in:
@ -1,4 +1,3 @@
|
||||
using System.Diagnostics.Tracing;
|
||||
using System.Text.Json.Serialization;
|
||||
using OSMDatastructure;
|
||||
using OSMDatastructure.Graph;
|
||||
|
@ -50,7 +50,7 @@ public class Pathfinder
|
||||
if (currentNode.Equals(goalNode))
|
||||
{
|
||||
Console.WriteLine("Path found.");
|
||||
this.pathResult = GetPath(goalNode, DateTime.Now - startCalc);
|
||||
pathResult = GetPath(goalNode, DateTime.Now - startCalc);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -23,29 +23,26 @@ namespace Pathfinding
|
||||
{
|
||||
if(_regions.TryGetValue(id, out Region? value))
|
||||
return value;
|
||||
else
|
||||
{
|
||||
Region? loadedRegion = RegionFromId(id);
|
||||
if(loadedRegion is not null)
|
||||
_regions.Add(loadedRegion!.regionHash, value: loadedRegion);
|
||||
return loadedRegion;
|
||||
}
|
||||
|
||||
Region? loadedRegion = RegionFromId(id);
|
||||
if(loadedRegion is not null)
|
||||
_regions.Add(loadedRegion!.regionHash, value: loadedRegion);
|
||||
return loadedRegion;
|
||||
}
|
||||
|
||||
public Region[] GetAllRegions()
|
||||
{
|
||||
return this._regions.Values.ToArray();
|
||||
return _regions.Values.ToArray();
|
||||
}
|
||||
|
||||
private Region? RegionFromFile(string filePath)
|
||||
{
|
||||
Region? retRegion = null;
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
FileStream regionFile = new FileStream(filePath, FileMode.Open);
|
||||
retRegion = JsonSerializer.Deserialize<Region>(regionFile, Region.serializerOptions)!;
|
||||
regionFile.Dispose();
|
||||
}
|
||||
if (!File.Exists(filePath))
|
||||
return null;
|
||||
|
||||
FileStream regionFile = new (filePath, FileMode.Open);
|
||||
Region retRegion = JsonSerializer.Deserialize<Region>(regionFile, Region.serializerOptions)!;
|
||||
regionFile.Dispose();
|
||||
return retRegion;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user