diff options
| author | historia <[not public]> | 2026-09-18 01:50:17 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 01:50:17 -0400 |
| commit | 87d08f0151e643951769e323995f1c5ed89ee200 (patch) | |
| tree | dc42a0b30ebb5a00dd7ba505cc4eaa44f4f308bc /internal/game/cmd_wear.go | |
| parent | 32a3c59cebf2a16277e54d715a67adfdbe00b456 (diff) | |
| download | thehouseoficarus-87d08f0151e643951769e323995f1c5ed89ee200.tar.gz | |
fix: harden economy recovery, shutdown concurrency, world validation, and inventory-loss paths
Diffstat (limited to 'internal/game/cmd_wear.go')
| -rw-r--r-- | internal/game/cmd_wear.go | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/internal/game/cmd_wear.go b/internal/game/cmd_wear.go index cea4d67..a02fd3b 100644 --- a/internal/game/cmd_wear.go +++ b/internal/game/cmd_wear.go @@ -94,13 +94,14 @@ func (g *Game) doWear(sess *net.Session, input string) { if slotOccupied { freeSlot := p.FirstFreeSlot() - if freeSlot == -1 && existingItemID != slot.ItemID { + // The equipped item must always be returned to the inventory before + // the new one is removed; with no free slot, refuse rather than + // silently destroy an identical equipped copy. + if freeSlot == -1 { sess.WriteLine("Your inventory is full.") return } - if freeSlot >= 0 { - p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: existingItemID, Quantity: 1}) - } + p.SetInvSlot(freeSlot, &player.InventorySlot{ItemID: existingItemID, Quantity: 1}) } if slot.Quantity > 1 { |
