Cleanup
This commit is contained in:
@@ -76,7 +76,7 @@ augmentedInvSizes = bimapAugmentInv _itInvSize closeObjectSize
|
||||
|
||||
bimapAugmentInv :: (Item -> a) -> (Either FloorItem Button -> a) -> World -> IM.IntMap a
|
||||
bimapAugmentInv f g w = IM.union
|
||||
(fmap f $ yourInv w)
|
||||
(f <$> yourInv w)
|
||||
(IM.fromAscList $ zip [length (yourInv w) ..] $ map g $ _closeObjects w)
|
||||
|
||||
invSelSize :: Int -> World -> Int
|
||||
@@ -108,7 +108,7 @@ updateCloseObjects w = w & closeObjects .~ unionBy closeObjEq oldCloseFiltered c
|
||||
& creatures . ix (_yourID w) . crInvSel %~ updateinvsel
|
||||
where
|
||||
updateinvsel curinvsel
|
||||
| length (augmentedInvSizes w) <= curinvsel = length (augmentedInvSizes w) - 1
|
||||
| length (augmentedInvSizes w) <= curinvsel = max 0 $ length (augmentedInvSizes w) - 1
|
||||
| otherwise = curinvsel
|
||||
filt = filter $ \obj -> dist ypos (closeObjPos obj) < 40 && hasLOS ypos (closeObjPos obj) w
|
||||
ypos = _crPos $ you w
|
||||
@@ -173,7 +173,7 @@ bestCloseObjectIndex w = findIndex f $ _closeObjects w
|
||||
selectedCloseObject :: World -> Maybe (Int,Either FloorItem Button)
|
||||
selectedCloseObject w
|
||||
| invsel >= length inv = Just $ selectNthCloseObject w (invsel - length inv)
|
||||
| otherwise = fmap (selectNthCloseObject w) $ bestCloseObjectIndex w
|
||||
| otherwise = selectNthCloseObject w <$> bestCloseObjectIndex w
|
||||
where
|
||||
invsel = _crInvSel cr
|
||||
cr = you w
|
||||
|
||||
Reference in New Issue
Block a user