AStar returns cell instead of path

This commit is contained in:
evanpelle
2024-12-03 14:35:09 -08:00
parent 330b6b93cb
commit 4edd66dc1f
12 changed files with 57 additions and 59 deletions
+2 -2
View File
@@ -72,7 +72,7 @@ export class PortExecution implements Execution {
const aStar = this.computingPaths.get(port)
switch (aStar.compute()) {
case PathFindResultType.Completed:
this.portPaths.set(port, aStar.reconstructPath().map(sn => sn as Tile))
this.portPaths.set(port, aStar.reconstructPath().map(cell => this.mg.tile(cell)))
this.computingPaths.delete(port)
break
case PathFindResultType.Pending:
@@ -101,7 +101,7 @@ export class PortExecution implements Execution {
const port = this.random.randElement(portConnections)
const path = this.portPaths.get(port)
if (path != null) {
const pf = PathFinder.Parallel(this.worker, 30)
const pf = PathFinder.Parallel(this.mg, this.worker, 30)
this.mg.addExecution(new TradeShipExecution(this.player().id(), this.port, port, pf, path))
}
}