only calculate cluster when tile changes

This commit is contained in:
evanpelle
2024-12-10 20:28:39 -08:00
committed by Evan
parent 097a94e5ab
commit b97ef32adb
7 changed files with 24 additions and 17 deletions
+4 -1
View File
@@ -4,7 +4,6 @@ import { assertNever, bfs, closestOceanShoreFromPlayer, dist, distSortUnit, manh
import { CellString, GameImpl } from "./GameImpl";
import { UnitImpl } from "./UnitImpl";
import { TileImpl } from "./TileImpl";
import { TerraNulliusImpl } from "./TerraNulliusImpl";
import { MessageType } from "../../client/graphics/layers/EventsDisplay";
import { renderTroops } from "../../client/graphics/Utils";
@@ -19,6 +18,7 @@ class Donation {
export class PlayerImpl implements MutablePlayer {
public _lastTileChange: number = 0
private _gold: Gold
private _troops: number
@@ -435,6 +435,9 @@ export class PlayerImpl implements MutablePlayer {
}
return spawns[0].tile()
}
lastTileChange(): Tick {
return this._lastTileChange
}
hash(): number {
return simpleHash(this.id()) * (this.population() + this.numTilesOwned()) + this._units.reduce((acc, unit) => acc + unit.hash(), 0)