diff --git a/src/Dodge/Data/HUD.hs b/src/Dodge/Data/HUD.hs index f30156a2f..463c40cee 100644 --- a/src/Dodge/Data/HUD.hs +++ b/src/Dodge/Data/HUD.hs @@ -23,7 +23,6 @@ data HUDElement , _diInvFilter :: Maybe String , _diCloseFilter :: Maybe String } --- | DisplayCarte data SubInventory = NoSubInventory @@ -38,7 +37,6 @@ data SubInventory , _ciSelection :: Maybe (Int, Int, IS.IntSet) , _ciFilter :: Maybe String } --- | LockedInventory | DisplayTerminal {_termID :: Int} data HUD = HUD diff --git a/src/Dodge/Inventory.hs b/src/Dodge/Inventory.hs index 944f28d90..c3499ed54 100644 --- a/src/Dodge/Inventory.hs +++ b/src/Dodge/Inventory.hs @@ -17,8 +17,6 @@ module Dodge.Inventory ( destroyAllInvItems, ) where ---import Dodge.Wall.Delete ---import Dodge.Item.Location import Data.Function import qualified Data.IntSet as IS import Data.Maybe @@ -26,7 +24,6 @@ import Dodge.Base import Dodge.Data.SelectionList import Dodge.Data.World import Dodge.Equipment ---import Dodge.Euse import Dodge.Inventory.CheckSlots import Dodge.Inventory.Location import Dodge.Inventory.RBList @@ -120,7 +117,6 @@ rmInvItem cid invid w = | x > invid || Just x == maxk = max 0 $ x - 1 | otherwise = x --- this looks ugly... updateCloseObjects :: World -> World updateCloseObjects w = w & hud . closeItems %~ f @@ -175,18 +171,23 @@ swapItemWith :: (Int, Int) -> World -> World -swapItemWith f (j, i) w = case j of - 0 -> w & swapInvItems f i - 3 -> w & changeSwapOther ispCloseItem 3 f i - 5 -> w & changeSwapOther ispCloseButton 5 f i - _ -> w +swapItemWith f (j, i) = case j of + 0 -> swapInvItems f i + 3 -> changeSwapOther ispCloseItem 3 f i + 5 -> changeSwapOther ispCloseButton 5 f i + _ -> id 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 +changeSwapWith f w + | Just (j,i,_) <- w ^. hud . hudElement . diSelection = swapItemWith f (j,i) w + | otherwise = 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 sel w =