Make rabbit happy

This commit is contained in:
Arkadiusz Sygulski
2026-01-16 23:14:29 +01:00
parent 7813d2e7dd
commit fe88ef4d2d
3 changed files with 20 additions and 2 deletions
@@ -18,7 +18,20 @@ export class MinHeap implements PriorityQueue {
push(node: number, priority: number): void {
if (this.size >= this.capacity) {
throw new Error(`MinHeap capacity exceeded: ${this.capacity}`);
console.error(
`MinHeap capacity exceeded (${this.capacity}). ` +
"Resizing, but this indicates a bug. Please investigate.",
);
this.capacity *= 2;
const newHeap = new Int32Array(this.capacity);
const newPri = new Float32Array(this.capacity);
newHeap.set(this.heap);
newPri.set(this.priorities);
this.heap = newHeap;
this.priorities = newPri;
}
let i = this.size++;
@@ -119,6 +119,10 @@ export class SpatialQuery {
const MAX_WAYPOINT_DIST = 200;
const PADDING = 10;
if (path.length < MIN_WAYPOINT_DIST) {
return path[0];
}
const bestTile = path[0];
const map = gm.map();
@@ -906,7 +906,8 @@ function updateTransportTimings(result) {
hpaTilesEl.textContent = "";
}
const totalTime = result.debug?.timings?.closestShoreByWater || 0;
const totalTime =
result.debug?.timings?.["SpatialQuery.closestShoreByWater"] ?? 0;
if (totalTime > 0) {
hpaTimeEl.textContent = `${totalTime.toFixed(2)}ms`;
hpaTimeEl.classList.remove("faded");