From 04d89987445bdee1774c84512cc04db6a4d40140 Mon Sep 17 00:00:00 2001 From: scamiv <6170744+scamiv@users.noreply.github.com> Date: Wed, 25 Feb 2026 22:36:06 +0100 Subject: [PATCH] refactor(pathfinding): remove unused PathStatus.PENDING Drop PENDING from PathStatus/PathResult and remove dead PENDING branches from TradeShipExecution, TransportShipExecution, and WarshipExecution. --- src/core/execution/TradeShipExecution.ts | 20 -------------------- src/core/execution/TransportShipExecution.ts | 2 -- src/core/execution/WarshipExecution.ts | 6 ------ src/core/pathfinding/types.ts | 8 +++----- 4 files changed, 3 insertions(+), 33 deletions(-) diff --git a/src/core/execution/TradeShipExecution.ts b/src/core/execution/TradeShipExecution.ts index 0538d42e5..2c6b80e59 100644 --- a/src/core/execution/TradeShipExecution.ts +++ b/src/core/execution/TradeShipExecution.ts @@ -110,26 +110,6 @@ export class TradeShipExecution implements Execution { const result = this.pathFinder.next(curTile, dst); switch (result.status) { - case PathStatus.PENDING: - if (dst !== this.motionPlanDst) { - this.motionPlanId++; - const from = curTile; - const path = this.pathFinder.findPath(from, dst) ?? [from]; - if (path.length === 0 || path[0] !== from) { - path.unshift(from); - } - - this.mg.recordMotionPlan({ - kind: "grid", - unitId: this.tradeShip.id(), - planId: this.motionPlanId, - startTick: ticks + 1, - ticksPerStep: 1, - path, - }); - this.motionPlanDst = dst; - } - break; case PathStatus.NEXT: if (dst !== this.motionPlanDst) { this.motionPlanId++; diff --git a/src/core/execution/TransportShipExecution.ts b/src/core/execution/TransportShipExecution.ts index 061811c34..3504e691c 100644 --- a/src/core/execution/TransportShipExecution.ts +++ b/src/core/execution/TransportShipExecution.ts @@ -248,8 +248,6 @@ export class TransportShipExecution implements Execution { case PathStatus.NEXT: this.boat.move(result.node); break; - case PathStatus.PENDING: - break; case PathStatus.NOT_FOUND: { // TODO: add to poisoned port list const map = this.mg.map(); diff --git a/src/core/execution/WarshipExecution.ts b/src/core/execution/WarshipExecution.ts index 189ad9924..70bfb654c 100644 --- a/src/core/execution/WarshipExecution.ts +++ b/src/core/execution/WarshipExecution.ts @@ -190,9 +190,6 @@ export class WarshipExecution implements Execution { case PathStatus.NEXT: this.warship.move(result.node); break; - case PathStatus.PENDING: - this.warship.touch(); - break; case PathStatus.NOT_FOUND: { console.log(`path not found to target`); break; @@ -221,9 +218,6 @@ export class WarshipExecution implements Execution { case PathStatus.NEXT: this.warship.move(result.node); break; - case PathStatus.PENDING: - this.warship.touch(); - return; case PathStatus.NOT_FOUND: { console.log(`path not found to target`); break; diff --git a/src/core/pathfinding/types.ts b/src/core/pathfinding/types.ts index 89e746957..c844b9df0 100644 --- a/src/core/pathfinding/types.ts +++ b/src/core/pathfinding/types.ts @@ -4,14 +4,12 @@ */ export enum PathStatus { - NEXT, - PENDING, - COMPLETE, - NOT_FOUND, + NEXT = 0, + COMPLETE = 2, + NOT_FOUND = 3, } export type PathResult = - | { status: PathStatus.PENDING } | { status: PathStatus.NEXT; node: T } | { status: PathStatus.COMPLETE; node: T } | { status: PathStatus.NOT_FOUND };