aboutsummaryrefslogtreecommitdiff
path: root/internal/game/exit_migrate.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/exit_migrate.go')
-rw-r--r--internal/game/exit_migrate.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/game/exit_migrate.go b/internal/game/exit_migrate.go
index 66fccfe..f6df05d 100644
--- a/internal/game/exit_migrate.go
+++ b/internal/game/exit_migrate.go
@@ -1,6 +1,7 @@
package game
import (
+ "log"
"strconv"
"strings"
@@ -190,4 +191,18 @@ func (g *Game) MigrateRoomIDsOnOwner(idMap map[int]int) {
// lookups agree with the post-migration layout.
g.World.RebuildRoomIndex(g.DataDir)
g.RewriteRoomIDs(idMap)
+
+ // Non-room content files (courses, modules, file-backed triggers) were
+ // rewritten with the same idMap. Reload their in-memory caches so gameplay
+ // follows the rename immediately instead of at the next restart. In-flight
+ // sequences hold pointers into the old trigger/step data, so abort them the
+ // same way a full content reload does.
+ if g.CourseStore != nil {
+ g.CourseStore.ReloadAll()
+ }
+ if err := g.LoadMods(); err != nil {
+ log.Printf("room-id migration: reload modules: %v", err)
+ }
+ g.abortAllSequences()
+ g.loadAllFlagTriggers()
}