From 87d08f0151e643951769e323995f1c5ed89ee200 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Fri, 18 Sep 2026 01:50:17 -0400 Subject: fix: harden economy recovery, shutdown concurrency, world validation, and inventory-loss paths --- internal/game/cmd_wear.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'internal/game/cmd_wear.go') 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 { -- cgit v1.2.3