diff options
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) |
