aboutsummaryrefslogtreecommitdiff
path: root/internal/game/account_txn.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/game/account_txn.go')
-rw-r--r--internal/game/account_txn.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/internal/game/account_txn.go b/internal/game/account_txn.go
index 13f7695..6e1e2d1 100644
--- a/internal/game/account_txn.go
+++ b/internal/game/account_txn.go
@@ -48,10 +48,10 @@ func (g *Game) adoptCharacterIdentity(p *player.Player, accountName string) {
p.Account = accountName
}
if err := g.AccountStore.SaveCharacter(p); err != nil {
- // Identity backfill is best-effort, but a NON-DURABLE ID must never
- // become an economy key: a later startup's backfill would assign a
- // different ID and strand every journal record written under this
- // one. Fall back to the durable character name instead.
+ // Identity backfill is best-effort, but a NON-DURABLE ID must not
+ // survive in memory: a later startup's backfill would assign a
+ // different one, and any reference cached under this ID would point
+ // at nothing. Fall back to the durable character name instead.
if assignedID != "" {
p.ID = ""
}
@@ -201,8 +201,9 @@ func (g *Game) renameCharacterTxn(accountName, oldName, newName string) error {
}
p.Name = newName
if p.ID == "" {
- // Assign the stable identity at rename time so journal records
- // written after this point resolve the renamed character by ID.
+ // Assign the stable identity at rename time so cached references
+ // (and the owner/membership checks) resolve the renamed character
+ // by ID rather than the new filename.
p.ID = newCharacterID()
}
data, err := g.AccountStore.MarshalCharacter(p)