aboutsummaryrefslogtreecommitdiff
path: root/internal/world/world.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 05:31:09 -0400
committerhistoria <[not public]>2026-09-18 05:31:09 -0400
commit153acb7f644d755c45533b7c5311e3ffa47e8973 (patch)
tree7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/world/world.go
parent87d08f0151e643951769e323995f1c5ed89ee200 (diff)
downloadthehouseoficarus-153acb7f644d755c45533b7c5311e3ffa47e8973.tar.gz
fix: harden engine across casino, economy, concurrency, security, and content
Diffstat (limited to 'internal/world/world.go')
-rw-r--r--internal/world/world.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/internal/world/world.go b/internal/world/world.go
index c5d0841..6a0313d 100644
--- a/internal/world/world.go
+++ b/internal/world/world.go
@@ -2,6 +2,7 @@ package world
import (
"fmt"
+ "log"
"os"
"path/filepath"
"strconv"
@@ -52,6 +53,13 @@ func (w *World) LoadRoom(id int) (*Room, error) {
if err := yaml.Unmarshal(data, &room); err != nil {
return nil, fmt.Errorf("parse room %d: %w", id, err)
}
+ // Room ID comes from the filename (room.ID = id below); a mismatched
+ // declared id: is silently ignored, so surface it rather than leave the
+ // author believing their written id is in use.
+ if room.ID != 0 && room.ID != id {
+ log.Printf("room %d: file %s declares id %d but is loaded as room %d; the filename is authoritative and the declared id is ignored",
+ id, path, room.ID, id)
+ }
room.ID = id
if room.Exits == nil {
room.Exits = make(map[ExitDir]ExitDef)