diff options
| author | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 05:31:09 -0400 |
| commit | 153acb7f644d755c45533b7c5311e3ffa47e8973 (patch) | |
| tree | 7645e6f7b65bc3830b078e3b9336d2e6b199d584 /internal/world/world.go | |
| parent | 87d08f0151e643951769e323995f1c5ed89ee200 (diff) | |
| download | thehouseoficarus-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.go | 8 |
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) |
