mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-29 03:44:40 +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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user