aboutsummaryrefslogtreecommitdiff
path: root/internal/game/core_login_char.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 20:03:13 -0400
committerhistoria <[not public]>2026-09-18 20:03:13 -0400
commit79764732406d6484f67d3dec045483dcb5d08c28 (patch)
tree7a64e8581a540b97ed554f5723e2d587424ab1c6 /internal/game/core_login_char.go
parentf1e461ab6aec6b9bf056bbe2daa88a251e0f21da (diff)
downloadthehouseoficarus-79764732406d6484f67d3dec045483dcb5d08c28.tar.gz
feat: better card ascii art
Diffstat (limited to 'internal/game/core_login_char.go')
-rw-r--r--internal/game/core_login_char.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/internal/game/core_login_char.go b/internal/game/core_login_char.go
index 3a2e324..41e25b8 100644
--- a/internal/game/core_login_char.go
+++ b/internal/game/core_login_char.go
@@ -2,6 +2,7 @@ package game
import (
"fmt"
+ "log"
"strings"
"thehouseoficarus/internal/net"
@@ -128,6 +129,18 @@ func (g *Game) connectCharacter(sess *net.Session, name string) {
}
}
+ // Rescue a character whose saved room no longer exists (the room was
+ // deleted, or a code-referenced teleport target was removed). Persisting
+ // a nonexistent RoomID soft-locks the character on every later login
+ // because movement and every room lookup fail.
+ if _, err := g.World.LoadRoom(p.RoomID); err != nil {
+ log.Printf("character %s: saved room %d no longer exists; relocating to starting room %d", p.Name, p.RoomID, g.StartingRoom)
+ p.RoomID = g.StartingRoom
+ if _, err := g.World.LoadRoom(p.RoomID); err != nil {
+ log.Printf("character %s: starting room %d also missing; leaving room as %d", p.Name, g.StartingRoom, p.RoomID)
+ }
+ }
+
p.Stats.RecordRoomVisit(p.RoomID)
g.World.SeedGroundItems(p.RoomID)
g.seedRoomMobs(p.RoomID)