From 875dcbb92650c93f9d2991630a132fe41852fe8c Mon Sep 17 00:00:00 2001 From: haunter Date: Sun, 17 Aug 2025 20:23:14 +0000 Subject: [PATCH] Update town.js --- town.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/town.js b/town.js index fb81c5a..a5c5982 100644 --- a/town.js +++ b/town.js @@ -54,9 +54,10 @@ // Compute Sea from x,y // ----------------------------- function computeSea(x, y) { - const seaY = Math.floor(y / 100); - const seaX = Math.floor(x / 100); - return seaY * 10 + seaX; + if (typeof x !== 'number' || typeof y !== 'number') return null; + const sx = Math.floor(x / 100); // col (0-based) + const sy = Math.floor(y / 100); // row (0-based) + return sx * 10 + sy; } // -----------------------------