Extend inv item location information to include "attached" items
This commit is contained in:
@@ -37,13 +37,20 @@ initCrItemLocations w cr = (w', cr & crInv .~ newinv)
|
||||
where
|
||||
(w',newinv) = imapAccumR (initCrItemLocation cr) w (_crInv cr)
|
||||
|
||||
-- does not worry about creature manipulation for now
|
||||
initCrItemLocation :: Creature -> Int -> LWorld -> Item -> (LWorld,Item)
|
||||
initCrItemLocation cr invid w it = (w & itemLocations . at locid ?~ loc
|
||||
,it & itID .~ locid
|
||||
& itLocation .~ loc)
|
||||
where
|
||||
locid = IM.newKey ( w ^. itemLocations)
|
||||
loc = InInv (_crID cr) invid False False
|
||||
loc = InInv
|
||||
{ _ilCrID = _crID cr
|
||||
, _ilInvID = invid
|
||||
, _ilIsRoot = False
|
||||
, _ilIsSelected = False
|
||||
, _ilIsAttached = False
|
||||
}
|
||||
|
||||
|
||||
initFlItemLocation :: LWorld -> FloorItem -> (LWorld, FloorItem)
|
||||
|
||||
Reference in New Issue
Block a user