Hide group selection in combine inventory, mempty on combine

This commit is contained in:
2024-11-25 21:55:10 +00:00
parent 445ca84358
commit f36f4b8536
3 changed files with 7 additions and 10 deletions
+1 -5
View File
@@ -22,8 +22,6 @@ data HUDElement
, _diSelection :: Maybe (Int, Int, IntSet) , _diSelection :: Maybe (Int, Int, IntSet)
, _diInvFilter :: Maybe String , _diInvFilter :: Maybe String
, _diCloseFilter :: Maybe String , _diCloseFilter :: Maybe String
-- , _diSelectionExtra :: IntSet -- this should probably be placed within _diSelection
-- would lead to inconsistency with _ciSelection
} }
| DisplayCarte | DisplayCarte
@@ -35,9 +33,7 @@ data HUDElement
data SubInventory data SubInventory
= NoSubInventory = NoSubInventory
| -- { _nsSelected :: MouseInventorySelection | ExamineInventory
-- }
ExamineInventory
| CombineInventory | CombineInventory
{ _ciSections :: IntMap (SelectionSection CombinableItem) { _ciSections :: IntMap (SelectionSection CombinableItem)
, _ciSelection :: Maybe (Int, Int, IS.IntSet) , _ciSelection :: Maybe (Int, Int, IS.IntSet)
+5 -1
View File
@@ -131,7 +131,11 @@ drawMouseOver cfig w =
drawDragSelected :: Configuration -> World -> Maybe Picture drawDragSelected :: Configuration -> World -> Maybe Picture
drawDragSelected cfig w = do drawDragSelected cfig w = do
ys <- w ^? hud . hudElement . diSelection . _Just . _3 ys <- w ^? hud . hudElement . diSelection . _Just . _3
guard $ not (IS.null ys) guard $ not (IS.null ys) &&
( case w ^? hud . hudElement . subInventory of
Just NoSubInventory -> True
_ -> False
)
(i, _, _) <- w ^? hud . hudElement . diSelection . _Just (i, _, _) <- w ^? hud . hudElement . diSelection . _Just
sss <- w ^? hud . hudElement . diSections sss <- w ^? hud . hudElement . diSections
let idp = invDisplayParams w let idp = invDisplayParams w
+1 -4
View File
@@ -268,9 +268,6 @@ shiftInvItems k x ab bn xs ss w = setSelWhileDragging . fromMaybe w $ do
guard $ Just (k,maxi+1) /= bn guard $ Just (k,maxi+1) /= bn
return $ shiftInvItemsDown k xs w return $ shiftInvItemsDown k xs w
_ -> Nothing _ -> Nothing
-- if x < (k,mini)
-- then
-- else
setSelWhileDragging :: World -> World setSelWhileDragging :: World -> World
setSelWhileDragging w = fromMaybe w $ do setSelWhileDragging w = fromMaybe w $ do
@@ -539,7 +536,6 @@ toggleTweakInv w = case w ^? hud . hudElement . subInventory of
thepointer = hud . hudElement . subInventory thepointer = hud . hudElement . subInventory
tryCombine :: tryCombine ::
-- IM.IntMap (SelectionSection CombinableItem) ->
(Int, Int) -> (Int, Int) ->
World -> World ->
World World
@@ -551,6 +547,7 @@ tryCombine (i, j) w = fromMaybe w $ do
snd (createItemYou it (foldr (destroyInvItem 0) w (sort is))) snd (createItemYou it (foldr (destroyInvItem 0) w (sort is)))
& cWorld . lWorld . creatures . ix 0 . crHammerPosition .~ HammerDown & cWorld . lWorld . creatures . ix 0 . crHammerPosition .~ HammerDown
& soundStart InventorySound p wrench1S Nothing & soundStart InventorySound p wrench1S Nothing
& hud . hudElement . diSelection . _Just . _3 .~ mempty
maybeExitCombine :: World -> World maybeExitCombine :: World -> World
maybeExitCombine w maybeExitCombine w