Cleanup
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
||||
All good (594 modules, at 15:45:51)
|
||||
All good (594 modules, at 16:25:03)
|
||||
|
||||
@@ -117,7 +117,7 @@ updateCloseObjects w =
|
||||
where
|
||||
g oldbts = intersect oldbts cbts `union` cbts
|
||||
f olditems = intersect olditems citems `union` citems
|
||||
cbts = fmap _btID $ filter (isclose . _btPos) activeButtons
|
||||
cbts = _btID <$> filter (isclose . _btPos) activeButtons
|
||||
citems =
|
||||
fmap _flItID
|
||||
. filter (isclose . _flItPos)
|
||||
|
||||
@@ -99,12 +99,11 @@ getRootItemBounds i inv = do
|
||||
y <- locLeftmost root ^? locLDT . ldtValue . cItem . itLocation . ilInvID
|
||||
return (x, y)
|
||||
|
||||
-- this should display while dragging a single inv item
|
||||
drawMouseOver :: Configuration -> World -> Picture
|
||||
drawMouseOver cfig w =
|
||||
concat
|
||||
( invsel <|> combinvsel
|
||||
<|> drawDragSelect cfig w
|
||||
<|> drawDragSelecting cfig w
|
||||
)
|
||||
<> concat (drawDragSelected cfig w)
|
||||
where
|
||||
@@ -141,8 +140,8 @@ drawDragSelected cfig w = do
|
||||
. IS.foldr f mempty
|
||||
$ ys
|
||||
|
||||
drawDragSelect :: Configuration -> World -> Maybe Picture
|
||||
drawDragSelect cfig w = do
|
||||
drawDragSelecting :: Configuration -> World -> Maybe Picture
|
||||
drawDragSelecting cfig w = do
|
||||
OverInvDragSelect (i, j) mselend <- w ^? input . mouseContext
|
||||
(a, b) <- mselend
|
||||
guard $ i == a
|
||||
|
||||
@@ -121,14 +121,15 @@ tryPickupSelected k mpos w = do
|
||||
let nfreeslots = crNumFreeSlots cr
|
||||
xs <- w ^? hud . hudElement . diSelectionExtra
|
||||
let itmstopickup = mapMaybe g $ IS.toList xs
|
||||
let slotsneeded = alaf Sum foldMap (_itInvSize . _flIt) $ itmstopickup
|
||||
let slotsneeded = alaf Sum foldMap (_itInvSize . _flIt) itmstopickup
|
||||
guard $ nfreeslots >= slotsneeded
|
||||
return $ case mpos of
|
||||
Nothing -> foldl' (flip $ pickUpItem 0) w itmstopickup
|
||||
& hud . hudElement . diSelectionExtra .~ mempty
|
||||
Just (_,j) -> foldr (pickUpItemAt j 0) w itmstopickup
|
||||
& hud . hudElement . diSelection ?~ (0,j)
|
||||
& hud . hudElement . diSelectionExtra .~ IS.fromDistinctAscList [j..j+IS.size xs-1]
|
||||
& hud . hudElement . diSelectionExtra
|
||||
.~ IS.fromDistinctAscList [j..j+IS.size xs-1]
|
||||
where
|
||||
g i = do
|
||||
NInt j <- w ^? hud . closeItems . ix i
|
||||
@@ -440,11 +441,11 @@ updateBackspaceRegex w = case di ^? subInventory of
|
||||
updateEnterRegex :: World -> World
|
||||
updateEnterRegex w = case w ^? hud . hudElement . subInventory of
|
||||
Just NoSubInventory{}
|
||||
| secfocus (-1) 0 ->
|
||||
| secfocus [-1,0,1] ->
|
||||
w & hud . hudElement . diSelection ?~ (-1, 0)
|
||||
& hud . hudElement . diInvFilter %~ enterregex
|
||||
Just NoSubInventory{}
|
||||
| secfocus 2 3 ->
|
||||
| secfocus [2,3] ->
|
||||
w & hud . hudElement . diSelection ?~ (2, 0)
|
||||
& hud . hudElement . diCloseFilter %~ enterregex
|
||||
Just CombineInventory{} ->
|
||||
@@ -453,9 +454,9 @@ updateEnterRegex w = case w ^? hud . hudElement . subInventory of
|
||||
_ -> w
|
||||
where
|
||||
di = w ^. hud . hudElement
|
||||
secfocus a b = fromMaybe False $ do
|
||||
secfocus xs = fromMaybe False $ do
|
||||
i <- di ^? diSelection . _Just . _1
|
||||
return $ i == a || i == b
|
||||
return $ i `elem` xs
|
||||
enterregex = (<|> Just "")
|
||||
|
||||
pauseGame :: Universe -> Universe
|
||||
|
||||
Reference in New Issue
Block a user