aboutsummaryrefslogtreecommitdiff
path: root/internal/game/account_txn.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-18 21:36:36 -0400
committerhistoria <[not public]>2026-09-18 21:36:36 -0400
commita8a67482bbff8297a96adff65d2fd7029ed998cc (patch)
treee84f8ba636c8f2edb4d2ff8b45d7cff7298fa7cc /internal/game/account_txn.go
parentff04d26ce90d6b411a04a2fb59f7c24ceefb161f (diff)
downloadthehouseoficarus-a8a67482bbff8297a96adff65d2fd7029ed998cc.tar.gz
refactor: replace economy journal with single-file pending-wager wallet
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)