Fix bug on dropping item when reloading
This commit is contained in:
@@ -55,6 +55,7 @@ rmInvItem :: Int -- ^ Creature id
|
||||
rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itConsumption . icAmount of
|
||||
Just x | x > 1 -> w & creatures . ix cid . crInv . ix invid . itConsumption . icAmount %~ subtract 1
|
||||
_ -> w & creatures . ix cid . crInv %~ f
|
||||
& creatures . ix cid . crInvSel %~ stopCrInvSelAction
|
||||
& creatures . ix cid . crInvSel . iselPos %~ g
|
||||
& creatures . ix cid . crLeftInvSel %~ g'
|
||||
& removeAnySlotEquipment
|
||||
@@ -64,6 +65,9 @@ rmInvItem cid invid w = case w ^? creatures . ix cid . crInv . ix invid . itCons
|
||||
& creatures . ix cid . crInvEquipped %~ IM.mapKeys g
|
||||
-- TODO check whether this can be mapKeysMonotonic
|
||||
where
|
||||
stopCrInvSelAction (InvSel i a)
|
||||
| i == invid = InvSel i NoInvSelAction
|
||||
| otherwise = InvSel i a
|
||||
cr = _creatures w IM.! cid
|
||||
itm = _crInv cr IM.! invid
|
||||
dounequipfunction = fromMaybe id $ do
|
||||
|
||||
Reference in New Issue
Block a user