From add27fd5d94dfdb8cc5fbf47d96c8e663e776dcc Mon Sep 17 00:00:00 2001 From: Evan Date: Sun, 6 Apr 2025 15:13:25 -0700 Subject: [PATCH] update unit position in UnitGrid when units move --- src/core/configuration/DevConfig.ts | 10 +++++----- src/core/game/UnitImpl.ts | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/configuration/DevConfig.ts b/src/core/configuration/DevConfig.ts index 259ccccad..853467814 100644 --- a/src/core/configuration/DevConfig.ts +++ b/src/core/configuration/DevConfig.ts @@ -1,4 +1,4 @@ -import { GameType, UnitInfo, UnitType } from "../game/Game"; +import { UnitInfo, UnitType } from "../game/Game"; import { UserSettings } from "../game/UserSettings"; import { GameConfig } from "../Schemas"; import { GameEnv, ServerConfig } from "./Config"; @@ -40,10 +40,10 @@ export class DevConfig extends DefaultConfig { super(sc, gc, us); } - numSpawnPhaseTurns(): number { - return this.gameConfig().gameType == GameType.Singleplayer ? 70 : 100; - // return 100 - } + // numSpawnPhaseTurns(): number { + // return this.gameConfig().gameType == GameType.Singleplayer ? 70 : 100; + // // return 100 + // } unitInfo(type: UnitType): UnitInfo { const info = super.unitInfo(type); diff --git a/src/core/game/UnitImpl.ts b/src/core/game/UnitImpl.ts index 4c24170e9..ac5b80fc6 100644 --- a/src/core/game/UnitImpl.ts +++ b/src/core/game/UnitImpl.ts @@ -86,6 +86,8 @@ export class UnitImpl implements Unit { } this._lastTile = this._tile; this._tile = tile; + this.mg.removeUnit(this); + this.mg.addUnit(this); this.mg.addUpdate(this.toUpdate()); } setTroops(troops: number): void {