mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-23 23:30:25 +00:00
dedup tileRef for tileUpdateSink(tileRef)
This commit is contained in:
@@ -181,9 +181,13 @@ export class GameRunner {
|
|||||||
let packedTileUpdates: BigUint64Array;
|
let packedTileUpdates: BigUint64Array;
|
||||||
const tileUpdates = updates[GameUpdateType.Tile];
|
const tileUpdates = updates[GameUpdateType.Tile];
|
||||||
if (this.tileUpdateSink !== undefined) {
|
if (this.tileUpdateSink !== undefined) {
|
||||||
|
const seenTiles = new Set<TileRef>();
|
||||||
for (const u of tileUpdates) {
|
for (const u of tileUpdates) {
|
||||||
const tileRef = Number(u.update >> 16n) as TileRef;
|
const tileRef = Number(u.update >> 16n) as TileRef;
|
||||||
this.tileUpdateSink(tileRef);
|
if (!seenTiles.has(tileRef)) {
|
||||||
|
seenTiles.add(tileRef);
|
||||||
|
this.tileUpdateSink(tileRef);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
packedTileUpdates = new BigUint64Array();
|
packedTileUpdates = new BigUint64Array();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user