mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-21 02:06:10 +00:00
only calculate cluster when tile changes
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user