Refactor floor items to use centralised items intmap
This commit is contained in:
@@ -217,9 +217,9 @@ drawExamineInventory cfig w =
|
||||
, _siPayload = Nothing
|
||||
}
|
||||
|
||||
closeObjectInfo :: Int -> Either FloorItem Button -> String
|
||||
closeObjectInfo :: Int -> Either Item Button -> String
|
||||
closeObjectInfo n x = case x of
|
||||
Left FlIt{_flIt = itm} -> itemInfo itm ++ " It is on the floor" ++ floorItemPickupInfo n itm
|
||||
Left itm -> itemInfo itm ++ " It is on the floor" ++ floorItemPickupInfo n itm
|
||||
Right _ -> "Some sort of switch or button."
|
||||
|
||||
floorItemPickupInfo :: Int -> Item -> String
|
||||
@@ -229,12 +229,12 @@ floorItemPickupInfo n itm
|
||||
|
||||
-- note the use of ^?!
|
||||
-- it is probably desirable for this to crash hard for now
|
||||
yourAugmentedItem :: (Item -> a) -> a -> (Either FloorItem Button -> a) -> World -> a
|
||||
yourAugmentedItem :: (Item -> a) -> a -> (Either Item Button -> a) -> World -> a
|
||||
yourAugmentedItem f x g w = case you w ^? crManipulation . manObject of
|
||||
Just (SelectedItem i _ _) -> f $ yourInv w ^?! ix i
|
||||
Just (SelCloseItem i) -> fromMaybe x $ do
|
||||
j <- w ^? hud . closeItems . ix i . unNInt
|
||||
flit <- w ^? cWorld . lWorld . floorItems . ix j
|
||||
flit <- w ^? cWorld . lWorld . items . ix j
|
||||
return . g $ Left flit
|
||||
Just (SelCloseButton i) -> fromMaybe x $ do
|
||||
j <- w ^? hud . closeButtons . ix i
|
||||
|
||||
Reference in New Issue
Block a user