SteamWar/FightSystem
Archiviert
13
1

Implement planToAnywhere
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Signed-off-by: Lixfel <agga-games@gmx.de>
Dieser Commit ist enthalten in:
Lixfel 2023-09-02 20:21:51 +02:00
Ursprung 26f2fb2afd
Commit 97113b1ae2

Datei anzeigen

@ -88,7 +88,15 @@ public class LixfelPathplanner {
}
public List<Vector> planToAnywhere(Vector start, Vector destination) {
return plan(start, destination); //TODO (destination neighbor search)
Vector intermediate = walkable.stream().filter(vector -> neighbouring(vector, destination)).findAny().orElse(null);
if(intermediate == null)
return Collections.emptyList();
List<Vector> plan = plan(start, intermediate);
plan.add(destination);
return plan;
}
public List<Vector> plan(Vector start, Vector destination) {