From 979197ef60cd74ca97bbfd7c3468add6ac1aae49 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Fri, 20 Jun 2025 12:40:23 -0700 Subject: [PATCH] fix is valid ref (#1240) ## Description: Fix the isValidRef check. Calling x() or y() on invalid ref causes it to throw exception. ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors ## Please put your Discord username so you can be contacted if a bug or regression is found: DISCORD_USERNAME --- src/core/game/GameMap.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/game/GameMap.ts b/src/core/game/GameMap.ts index 6081cafa3..8694afd44 100644 --- a/src/core/game/GameMap.ts +++ b/src/core/game/GameMap.ts @@ -118,7 +118,7 @@ export class GameMapImpl implements GameMap { } isValidRef(ref: TileRef): boolean { - return this.isValidCoord(this.x(ref), this.y(ref)); + return ref >= 0 && ref < this.refToX.length; } x(ref: TileRef): number {