Refactor contest duration management in TerritoryLayer and TerritoryWebGLRenderer

- Introduced a constant for default contest duration in TerritoryLayer
- Updated contest duration handling in TerritoryWebGLRenderer
This commit is contained in:
scamiv
2026-01-10 20:37:40 +01:00
parent f217b1e1ce
commit 9f71dcc4e9
2 changed files with 3 additions and 2 deletions
+2 -1
View File
@@ -20,6 +20,7 @@ import { TerritoryWebGLRenderer } from "./TerritoryWebGLRenderer";
const CONTEST_ID_MASK = 0x7fff;
const CONTEST_ATTACKER_EVER_BIT = 0x8000;
const CONTEST_TIME_WRAP = 32768;
const DEFAULT_CONTEST_DURATION_MS = 200;
type ContestComponent = {
id: number;
@@ -54,7 +55,7 @@ export class TerritoryLayer implements Layer {
private lastFocusedPlayer: PlayerView | null = null;
private lastMyPlayerSmallId: number | null = null;
private lastPaletteSignature: string | null = null;
private contestDurationMs = 1000;
private contestDurationMs = DEFAULT_CONTEST_DURATION_MS;
private contestActive = false;
private contestNextId = 1;
private contestFreeIds: number[] = [];
@@ -903,7 +903,7 @@ export class TerritoryWebGLRenderer {
setContestNow(nowPacked: number, durationMs: number) {
this.contestNow = nowPacked | 0;
this.contestDurationMs = Math.max(1, durationMs);
this.contestDurationMs = Math.max(0, durationMs);
}
snapshotStateForSmoothing() {