mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-04 05:50:35 +00:00
have core/ directory use consolex for remote logging
This commit is contained in:
@@ -5,6 +5,7 @@ import { PriorityQueue } from "@datastructures-js/priority-queue";
|
||||
import { SerialAStar } from "../pathfinding/SerialAStar";
|
||||
import { AStar, PathFindResultType, SearchNode } from "../pathfinding/AStar";
|
||||
import { MiniAStar } from "../pathfinding/MiniAStar";
|
||||
import { consolex } from "../Consolex";
|
||||
|
||||
let terrainMapPromise: Promise<{
|
||||
terrainMap: TerrainMap,
|
||||
@@ -99,7 +100,7 @@ function computeSearches() {
|
||||
searches.push(search)
|
||||
break
|
||||
case PathFindResultType.PathNotFound:
|
||||
console.warn(`worker: path not found to port`);
|
||||
consolex.warn(`worker: path not found to port`);
|
||||
self.postMessage({
|
||||
type: 'pathNotFound',
|
||||
requestId: search.requestId,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { consolex } from "../Consolex";
|
||||
import { Cell, Game, GameMap, TerrainTile, TerrainType, Tile } from "../game/Game";
|
||||
import { AStar, PathFindResultType } from "../pathfinding/AStar";
|
||||
import { MiniAStar } from "../pathfinding/MiniAStar";
|
||||
@@ -111,7 +112,7 @@ export class ParallelAStar implements AStar {
|
||||
}
|
||||
// Path was not found in worker thread in time, so now we need
|
||||
// to recompute it in main thread. This will lock up game.
|
||||
console.warn(`path not completed in worker thread, recomputing`)
|
||||
consolex.warn(`path not completed in worker thread, recomputing`)
|
||||
const local = new MiniAStar(
|
||||
this.game.terrainMap(),
|
||||
this.game.terrainMiniMap(),
|
||||
@@ -123,7 +124,7 @@ export class ParallelAStar implements AStar {
|
||||
const result = local.compute()
|
||||
switch (result) {
|
||||
case PathFindResultType.Completed:
|
||||
console.log('recomputed path in worker client')
|
||||
consolex.log('recomputed path in worker client')
|
||||
this.path = local.reconstructPath()
|
||||
break
|
||||
case PathFindResultType.PathNotFound:
|
||||
@@ -131,7 +132,7 @@ export class ParallelAStar implements AStar {
|
||||
break
|
||||
case PathFindResultType.Pending:
|
||||
// TODO: make sure same number of tries as worker thread.
|
||||
console.warn("path not found after many tries")
|
||||
consolex.warn("path not found after many tries")
|
||||
this.path = "NOT_FOUND"
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user