Tweak inventory management
This commit is contained in:
+4
-11
@@ -4,6 +4,9 @@
|
||||
Basic helpers.
|
||||
Consider splitting. -}
|
||||
module Dodge.Base
|
||||
( module Dodge.Base
|
||||
, module Dodge.Base.You
|
||||
)
|
||||
where
|
||||
import Dodge.Data
|
||||
import Dodge.WinScale
|
||||
@@ -14,6 +17,7 @@ import Geometry
|
||||
--import Picture
|
||||
import qualified IntMapHelp as IM
|
||||
import FoldableHelp
|
||||
import Dodge.Base.You
|
||||
|
||||
import Control.Lens
|
||||
import qualified Control.Foldl as L
|
||||
@@ -42,20 +46,9 @@ errorHead :: String -> [a] -> a
|
||||
errorHead _ (x:_) = x
|
||||
errorHead s [] = error s
|
||||
|
||||
you :: World -> Creature
|
||||
you w = _creatures w IM.! _yourID w
|
||||
|
||||
aCrPos :: Int -> World -> Point2
|
||||
aCrPos i w = _crPos $ _creatures w IM.! i
|
||||
|
||||
yourItem :: World -> Maybe Item
|
||||
yourItem w = _crInv (you w) IM.!? _crInvSel (you w)
|
||||
|
||||
yourInv :: World -> IM.IntMap Item
|
||||
yourInv w = _crInv (you w)
|
||||
|
||||
yourInvSel :: World -> Int
|
||||
yourInvSel w = _crInvSel (you w)
|
||||
|
||||
selectedObject :: World -> Maybe (Either FloorItem Button)
|
||||
selectedObject w = lookup (_crInvSel ycr) $ zip [n..] $ _closeObjects w
|
||||
|
||||
Reference in New Issue
Block a user