Fix inventory swapping equipment bug

This commit is contained in:
2022-05-22 15:50:25 +01:00
parent fd40da2d4a
commit b83392d441
8 changed files with 45 additions and 18 deletions
+5 -5
View File
@@ -210,12 +210,13 @@ dropExcept cr invid w = foldr (dropItem cr) w . IM.keys
$ invid `IM.delete` _crInv cr
dropItem :: Creature -> Int -> World -> World
dropItem cr invid = rmInvItem cid invid . copyInvItemToFloor cr invid . mayberemoveequip
dropItem cr invid = rmInvItem cid invid . copyInvItemToFloor cr invid -- . mayberemoveequip
where
cid = _crID cr
mayberemoveequip = case _crLeftInvSel cr of
Just i | i == invid -> creatures . ix cid . crLeftInvSel .~ Nothing
_ -> id
-- the following should be done in rmInvItem
-- mayberemoveequip = case _crLeftInvSel cr of
-- Just i | i == invid -> creatures . ix cid . crLeftInvSel .~ Nothing
-- _ -> id
youDropItem :: World -> World
youDropItem w
@@ -239,7 +240,6 @@ copyInvItemToFloor cr i = copyItemToFloor (_crPos cr)
& itIsHeld .~ False
)
sizeSelf :: Float -> Creature -> World -> Maybe World
sizeSelf x cr w
-- | _crPos cr1 == _crPos cr2 = Just $ w