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.go13
1 files changed, 3 insertions, 10 deletions
diff --git a/internal/game/exit_migrate.go b/internal/game/exit_migrate.go
index f6df05d..4edab95 100644
--- a/internal/game/exit_migrate.go
+++ b/internal/game/exit_migrate.go
@@ -6,6 +6,7 @@ import (
"strings"
"thehouseoficarus/internal/player"
+ "thehouseoficarus/internal/world"
)
// rewritePlayerRoomIDs remaps room-ID-embedded state in a single player per
@@ -21,10 +22,10 @@ func rewritePlayerRoomIDs(p *player.Player, idMap map[int]int) bool {
return false
}
changed := false
- if remapScalar(idMap, &p.RoomID) {
+ if world.RemapInt(idMap, &p.RoomID) {
changed = true
}
- if p.PendingSequence != nil && p.PendingSequence.RoomID != 0 && remapScalar(idMap, &p.PendingSequence.RoomID) {
+ if p.PendingSequence != nil && p.PendingSequence.RoomID != 0 && world.RemapInt(idMap, &p.PendingSequence.RoomID) {
changed = true
}
if len(p.Flags) > 0 && rewriteDiscoveredExitFlags(p.Flags, idMap) {
@@ -41,14 +42,6 @@ func rewritePlayerRoomIDs(p *player.Player, idMap map[int]int) bool {
return changed
}
-func remapScalar(idMap map[int]int, n *int) bool {
- if newID, ok := idMap[*n]; ok && newID != *n {
- *n = newID
- return true
- }
- return false
-}
-
// rewriteDiscoveredExitFlags rewrites hidden_exit_<roomID>_<dir> flag keys,
// remapping the embedded roomID per idMap. Flag values are preserved.
func rewriteDiscoveredExitFlags(flags map[string]any, idMap map[int]int) bool {