use TileRef instead of tile

This commit is contained in:
evanpelle
2025-02-01 12:05:11 -08:00
committed by Evan
parent 2068e42982
commit a17ae48cd3
13 changed files with 149 additions and 98 deletions
+7 -2
View File
@@ -14,7 +14,9 @@ export class TileView {
constructor(private game: GameView, public data: TileUpdate, private _terrain: TerrainTile) { }
ref(): TileRef {
throw new Error('uh oh')
if (!this.data) { return 0 }
return this.data.pos.x * this.game.width() + this.data.pos.y
}
type(): TerrainType {
return this._terrain.type()
@@ -123,6 +125,9 @@ export class UnitView implements Unit {
export class PlayerView implements Player {
constructor(private game: GameView, public data: PlayerUpdate, public nameData: NameViewData) { }
borderTiles(): ReadonlySet<Tile> {
throw new Error('Method not implemented.');
}
async actions(tile: Tile): Promise<PlayerActions> {
return this.game.worker.playerInteraction(this.id(), tile)
@@ -187,7 +192,7 @@ export class PlayerView implements Player {
allianceWith(other: Player): Alliance | null {
return null
}
borderTiles(): ReadonlySet<Tile> {
borderTileRefs(): ReadonlySet<TileRef> {
return new Set()
}
units(...types: UnitType[]): Unit[] {