mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-16 11:53:17 +00:00
AStar returns cell instead of path
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Cell, Execution, MutableGame, MutablePlayer, MutableUnit, PlayerID, Tile, UnitType } from "../game/Game";
|
||||
import { Cell, Execution, MutableGame, MutablePlayer, MutableUnit, PlayerID, TerrainType, Tile, UnitType } from "../game/Game";
|
||||
import { PathFinder } from "../pathfinding/PathFinding";
|
||||
import { PathFindResultType } from "../pathfinding/AStar";
|
||||
import { SerialAStar } from "../pathfinding/SerialAStar";
|
||||
@@ -14,7 +14,7 @@ export class DestroyerExecution implements Execution {
|
||||
private mg: MutableGame = null
|
||||
|
||||
private target: MutableUnit = null
|
||||
private pathfinder = PathFinder.Serial(5000, t => t.isWater())
|
||||
private pathfinder: PathFinder
|
||||
|
||||
private patrolTile: Tile;
|
||||
private patrolCenterTile: Tile
|
||||
@@ -29,6 +29,7 @@ export class DestroyerExecution implements Execution {
|
||||
|
||||
|
||||
init(mg: MutableGame, ticks: number): void {
|
||||
this.pathfinder = PathFinder.Serial(mg, 5000, t => t.terrainType() == TerrainType.Ocean)
|
||||
this._owner = mg.player(this.playerID)
|
||||
this.mg = mg
|
||||
this.patrolCenterTile = mg.tile(this.cell)
|
||||
|
||||
Reference in New Issue
Block a user