This commit is contained in:
2025-08-19 20:43:35 +01:00
parent 084210ea7d
commit 68cd362aa4
2 changed files with 15 additions and 16 deletions
-2
View File
@@ -23,7 +23,6 @@ data HUDElement
, _diInvFilter :: Maybe String , _diInvFilter :: Maybe String
, _diCloseFilter :: Maybe String , _diCloseFilter :: Maybe String
} }
-- | DisplayCarte
data SubInventory data SubInventory
= NoSubInventory = NoSubInventory
@@ -38,7 +37,6 @@ data SubInventory
, _ciSelection :: Maybe (Int, Int, IS.IntSet) , _ciSelection :: Maybe (Int, Int, IS.IntSet)
, _ciFilter :: Maybe String , _ciFilter :: Maybe String
} }
-- | LockedInventory
| DisplayTerminal {_termID :: Int} | DisplayTerminal {_termID :: Int}
data HUD = HUD data HUD = HUD
+15 -14
View File
@@ -17,8 +17,6 @@ module Dodge.Inventory (
destroyAllInvItems, destroyAllInvItems,
) where ) where
--import Dodge.Wall.Delete
--import Dodge.Item.Location
import Data.Function import Data.Function
import qualified Data.IntSet as IS import qualified Data.IntSet as IS
import Data.Maybe import Data.Maybe
@@ -26,7 +24,6 @@ import Dodge.Base
import Dodge.Data.SelectionList import Dodge.Data.SelectionList
import Dodge.Data.World import Dodge.Data.World
import Dodge.Equipment import Dodge.Equipment
--import Dodge.Euse
import Dodge.Inventory.CheckSlots import Dodge.Inventory.CheckSlots
import Dodge.Inventory.Location import Dodge.Inventory.Location
import Dodge.Inventory.RBList import Dodge.Inventory.RBList
@@ -120,7 +117,6 @@ rmInvItem cid invid w =
| x > invid || Just x == maxk = max 0 $ x - 1 | x > invid || Just x == maxk = max 0 $ x - 1
| otherwise = x | otherwise = x
-- this looks ugly...
updateCloseObjects :: World -> World updateCloseObjects :: World -> World
updateCloseObjects w = updateCloseObjects w =
w & hud . closeItems %~ f w & hud . closeItems %~ f
@@ -175,18 +171,23 @@ swapItemWith ::
(Int, Int) -> (Int, Int) ->
World -> World ->
World World
swapItemWith f (j, i) w = case j of swapItemWith f (j, i) = case j of
0 -> w & swapInvItems f i 0 -> swapInvItems f i
3 -> w & changeSwapOther ispCloseItem 3 f i 3 -> changeSwapOther ispCloseItem 3 f i
5 -> w & changeSwapOther ispCloseButton 5 f i 5 -> changeSwapOther ispCloseButton 5 f i
_ -> w _ -> id
changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
changeSwapWith f w = case w ^? hud . hudElement . diSelection . _Just of changeSwapWith f w
Just (0, i, _) -> w & swapInvItems f i | Just (j,i,_) <- w ^. hud . hudElement . diSelection = swapItemWith f (j,i) w
Just (3, i, _) -> w & changeSwapOther ispCloseItem 3 f i | otherwise = w
Just (5, i, _) -> w & changeSwapOther ispCloseButton 5 f i
_ -> w --changeSwapWith :: (Int -> IM.IntMap (SelectionItem ()) -> Maybe Int) -> World -> World
--changeSwapWith f w = case w ^? hud . hudElement . diSelection . _Just of
-- Just (0, i, _) -> w & swapInvItems f i
-- Just (3, i, _) -> w & changeSwapOther ispCloseItem 3 f i
-- Just (5, i, _) -> w & changeSwapOther ispCloseButton 5 f i
-- _ -> w
invSetSelection :: (Int, Int, IS.IntSet) -> World -> World invSetSelection :: (Int, Int, IS.IntSet) -> World -> World
invSetSelection sel w = invSetSelection sel w =