Fixed pathfinder bug

This commit is contained in:
Beny 2019-05-05 05:21:02 +01:00
parent 7e6a63bc38
commit 122c646c13

View File

@ -407,14 +407,11 @@ public class RoomLayout
return null; return null;
RoomTile cheapest = openList.get(0); RoomTile cheapest = openList.get(0);
int cheapestFcost = Integer.MAX_VALUE;
for (RoomTile anOpenList : openList) for (RoomTile anOpenList : openList)
{ {
int f = cheapest.getfCosts(); if (anOpenList.getfCosts() < cheapest.getfCosts())
if (anOpenList.getfCosts() < cheapestFcost)
{ {
cheapest = anOpenList; cheapest = anOpenList;
cheapestFcost = f;
} }
} }
return cheapest; return cheapest;