diff --git a/src/core/GameRunner.ts b/src/core/GameRunner.ts index b5a36a63a..b2a2e28a2 100644 --- a/src/core/GameRunner.ts +++ b/src/core/GameRunner.ts @@ -20,7 +20,6 @@ export async function createGameRunner(gameID: string, gameConfig: GameConfig, c export class GameRunner { private updatedTiles: Set = new Set() - private borderOnlyUpdated: Set = new Set() private tickInterval = null private turns: Turn[] = [] private currTurn = 0 @@ -37,11 +36,6 @@ export class GameRunner { init() { this.eventBus.on(TileEvent, (e) => { this.updatedTiles.add(e.tile as MutableTile) - if (e.borderOnlyChange) { - this.borderOnlyUpdated.add(e.tile as MutableTile) - } else { - this.updatedTiles.add(e.tile as MutableTile) - } }) this.game.addExecution(...this.execManager.spawnBots(this.game.config().numBots())) if (this.game.config().spawnNPCs()) { @@ -64,7 +58,6 @@ export class GameRunner { } this.isExecuting = true this.updatedTiles.clear() - this.borderOnlyUpdated.clear() this.game.addExecution(...this.execManager.createExecs(this.turns[this.currTurn])) @@ -72,23 +65,10 @@ export class GameRunner { this.game.executeNextTick() - - - this.updatedTiles.forEach(t => this.borderOnlyUpdated.delete(t)) - const updatedData = Array.from(this.updatedTiles).map(t => t.toViewData()) - updatedData.forEach(t => t.borderOnlyChange = false) - - const borderOnlyData = Array.from(this.borderOnlyUpdated).map(t => t.toViewData()) - borderOnlyData.forEach(t => t.borderOnlyChange = true) - - updatedData.concat(borderOnlyData) - - - this.callBack({ tick: this.game.ticks(), units: this.game.units().map(u => u.toViewData()), - packedTileUpdates: updatedData.map(d => packTileData(d)), + packedTileUpdates: Array.from(this.updatedTiles).map(t => packTileData(t.toViewData())), players: Object.fromEntries( this.game.allPlayers().map(p => [p.id(), p.toViewData()]) ) as Record diff --git a/src/core/GameView.ts b/src/core/GameView.ts index 90e0036a8..3d2e65029 100644 --- a/src/core/GameView.ts +++ b/src/core/GameView.ts @@ -19,7 +19,6 @@ export interface TileViewData extends ViewData { hasFallout: boolean hasDefenseBonus: boolean isBorder: boolean - borderOnlyChange: boolean } export class TileView { @@ -350,8 +349,7 @@ export function packTileData(tile: TileViewData): Uint16Array { // Pack booleans into bits packed[3] = (tile.hasFallout ? 1 : 0) | (tile.hasDefenseBonus ? 2 : 0) | - (tile.isBorder ? 4 : 0) | - (tile.borderOnlyChange ? 8 : 0) + (tile.isBorder ? 4 : 0) return packed; } @@ -364,6 +362,5 @@ export function unpackTileData(packed: Uint16Array): TileViewData { hasFallout: !!(packed[3] & 1), hasDefenseBonus: !!(packed[3] & 2), isBorder: !!(packed[3] & 4), - borderOnlyChange: !!(packed[4] & 8) }; } \ No newline at end of file diff --git a/src/core/game/TileImpl.ts b/src/core/game/TileImpl.ts index 70a1322bd..5cf699e21 100644 --- a/src/core/game/TileImpl.ts +++ b/src/core/game/TileImpl.ts @@ -31,7 +31,6 @@ export class TileImpl implements MutableTile { hasFallout: this._hasFallout, hasDefenseBonus: this.hasDefenseBonus(), isBorder: this.isBorder(), - borderOnlyChange: false, } }