Rethink selection lists as intmaps

This commit is contained in:
2023-01-15 23:17:47 +00:00
parent 17734738f6
commit 048135c370
17 changed files with 245 additions and 93 deletions
+4 -3
View File
@@ -2,10 +2,11 @@ module Dodge.Update.Scroll (
updateWheelEvent,
) where
import SelectionIntMap
import Dodge.SelectionList
import qualified Data.Map.Strict as M
import Data.Maybe
import Dodge.Base
import Dodge.Combine
import Dodge.Data.Universe
import Dodge.HeldScroll
import Dodge.InputFocus
@@ -49,11 +50,11 @@ updateWheelEvent yi w = case w ^. hud . hudElement of
invKeyDown = ScancodeCapsLock `M.member` _pressedKeys (_input w)
moveCombineSel :: Int -> World -> World
moveCombineSel yi w = moveSubSel yi (length $ combineItemListYou w) w
moveCombineSel yi = hud . hudElement . subInventory . subInvMap %~ moveSelectionMapSelection yi
moveSubSel :: Int -> Int -> World -> World
moveSubSel yi maxyi =
hud . hudElement . subInventory . subInvSel . _Just
hud . hudElement . subInventory . subInvMSel . _Just
%~ ((`mod` maxyi) . subtract yi)
guardDisconnectedID :: Int -> World -> World -> World