Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.meta
14 changes: 12 additions & 2 deletions pathfinding/ShortestPathGraphSearch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,10 @@ public List<Action> GetShortestPath(State fromState, State toState){
#endif

frontierMap.Add(fromState, startNode);

while (!frontier.IsEmpty){
int shortCircuit = 0;
while (!frontier.IsEmpty)
{
shortCircuit++;
SearchNode<State,Action> node = frontier.Dequeue();
frontierMap.Remove(node.state);

Expand Down Expand Up @@ -114,9 +116,17 @@ public List<Action> GetShortestPath(State fromState, State toState){
#else
frontier.Replace(frontierNode,frontierNode.f, searchNode.f);
#endif
// reset f on the frontier node to made it's new position in the priority queue
frontierNode.f = searchNode.f;
}
}
}

if (shortCircuit > 3000)
{
DebugLog.Log("Short circuiting pathfinder, took more than 3000 tries");
break;
}
}

return null;
Expand Down
2 changes: 1 addition & 1 deletion unittest/UUnitAssert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static void Equals(object expected, object actual, string msg){
Error(expected, actual, msg);
}

public static new void Equals(Vector3 expected, Vector3 actual){
public static void Equals(Vector3 expected, Vector3 actual){
Equals(expected, actual,"");
}

Expand Down
2 changes: 1 addition & 1 deletion unittest/UUnitTestResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public TestResultEntry(string className, string methodName,bool success,UUnitAss
this.errormsg = errormsg;
}

public new string ToString(bool shortSummary = false){
public string ToString(bool shortSummary = false){
string res = (success?
"SUCCESS ":
"FAIL ")+className+"."+methodName+" duration: "+duration+" ";
Expand Down