Commit before attempting to move some data into a "local" world type
This commit is contained in:
@@ -6,6 +6,7 @@ module Dodge.Creature.Action
|
||||
, stripNoItems
|
||||
, setMinInvSize
|
||||
, dropUnselected
|
||||
, dropExcept
|
||||
, startReloadingWeapon
|
||||
, blinkAction
|
||||
, sizeSelf
|
||||
@@ -215,13 +216,17 @@ organiseInvKeys cid w = w & creatures . ix cid %~
|
||||
where
|
||||
cr = _creatures w IM.! cid
|
||||
pairs = IM.toList (_crInv cr)
|
||||
newSelKey = fromJust $ findIndex ( (== _crInvSel cr) . fst) pairs
|
||||
newSelKey = fromMaybe 0 $ findIndex ( (== _crInvSel cr) . fst) pairs
|
||||
newInv = IM.fromAscList $ zip [0..] $ map snd pairs
|
||||
|
||||
dropUnselected :: Creature -> World -> World
|
||||
dropUnselected cr w = foldr (dropItem cr) w . IM.keys
|
||||
$ _crInvSel cr `IM.delete` _crInv cr
|
||||
|
||||
dropExcept :: Creature -> Int -> World -> World
|
||||
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
|
||||
where
|
||||
|
||||
Reference in New Issue
Block a user