mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-21 12:51:30 +00:00
Make rabbit happy
This commit is contained in:
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user