Commit before only putting item locations in single itemLocations intmap

This commit is contained in:
2024-09-24 09:31:20 +01:00
parent 77e5f684aa
commit a6eb5cf982
8 changed files with 242 additions and 216 deletions
+15
View File
@@ -3,6 +3,7 @@ module Dodge.Inventory (
checkInvSlotsYou,
rmSelectedInvItem,
rmInvItem,
destroyInvItem,
updateCloseObjects,
changeSwapSel,
scrollAugInvSel,
@@ -35,6 +36,20 @@ import ListHelp
-- TODO check what happens to selection index when dropping non-selected items
-- should consider never fully destroying items, but assigning a flag saying how
-- they were moved from play
destroyInvItem ::
Int ->
-- | Inventory position
Int ->
World ->
World
destroyInvItem cid invid w = rmInvItem cid invid w & removeitloc
where
removeitloc = fromMaybe id $ do
itid <- w ^? cWorld . lWorld . creatures . ix cid . crInv . ix invid . itID
return $ cWorld . lWorld . itemLocations . at itid .~ Nothing
-- | after this the item at the inventory position will no longer exist
rmInvItem ::
-- | Creature id