game kind of working with GameView

This commit is contained in:
Evan
2025-01-03 11:15:11 -08:00
parent 3e8517363f
commit 2441abd7c8
11 changed files with 76 additions and 65 deletions
+1
View File
@@ -159,6 +159,7 @@ export interface TerrainMap {
neighbors(terrainTile: TerrainTile): TerrainTile[]
width(): number
height(): number
isOnMap(cell: Cell): boolean
}
export interface TerrainTile extends SearchNode {
+2 -2
View File
@@ -47,7 +47,7 @@ export class GameImpl implements MutableGame {
public eventBus: EventBus,
private _config: Config,
) {
this._terraNullius = new TerraNulliusImpl(this)
this._terraNullius = new TerraNulliusImpl()
this._width = _terrainMap.width();
this._height = _terrainMap.height();
this._numLandTiles = _terrainMap.numLandTiles
@@ -145,7 +145,7 @@ export class GameImpl implements MutableGame {
}
inSpawnPhase(): boolean {
return this._ticks <= this.config().numSpawnPhaseTurns(this.config().gameConfig().gameType)
return this._ticks <= this.config().numSpawnPhaseTurns()
}
ticks(): number {
+5 -5
View File
@@ -1,13 +1,13 @@
import {ClientID} from "../Schemas";
import {TerraNullius, Cell, Tile, PlayerID} from "./Game";
import {GameImpl} from "./GameImpl";
import { ClientID } from "../Schemas";
import { TerraNullius, Cell, Tile, PlayerID } from "./Game";
import { GameImpl } from "./GameImpl";
export class TerraNulliusImpl implements TerraNullius {
public tiles: Map<Cell, Tile> = new Map<Cell, Tile>();
constructor(private gs: GameImpl) {
constructor() {
}
clientID(): ClientID {
return "TERRA_NULLIUS_CLIENT_ID"
@@ -20,5 +20,5 @@ export class TerraNulliusImpl implements TerraNullius {
ownsTile(cell: Cell): boolean {
return this.tiles.has(cell);
}
isPlayer(): false {return false as const;}
isPlayer(): false { return false as const; }
}
+3
View File
@@ -85,6 +85,9 @@ export class TerrainMapImpl implements TerrainMap {
public nationMap: NationMap
constructor(
) { }
isOnMap(cell: Cell): boolean {
return cell.x >= 0 && cell.x < this.tiles.length && cell.y >= 0 && cell.y < this.tiles[0].length
}
neighbors(terrainTile: TerrainTile): TerrainTile[] {
return (terrainTile as TerrainTileImpl).neighbors();