Rethink selection lists as intmaps
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Dodge.Data.Combine where
|
||||
import Control.Lens
|
||||
import Dodge.Data.Item
|
||||
data CombinableItem = CombinableItem
|
||||
{ _ciInvIDs :: [Int]
|
||||
, _ciItem :: Item
|
||||
, _ciInfo :: [String]
|
||||
}
|
||||
makeLenses ''CombinableItem
|
||||
@@ -5,7 +5,8 @@
|
||||
|
||||
module Dodge.Data.HUD where
|
||||
|
||||
--import Dodge.Data.SelectionList
|
||||
import Dodge.Data.Combine
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.Button
|
||||
import Dodge.Data.FloorItem
|
||||
import Control.Lens
|
||||
@@ -20,9 +21,8 @@ data HUDElement
|
||||
|
||||
data SubInventory
|
||||
= NoSubInventory
|
||||
| ExamineInventory {_subInvSel :: Maybe Int}
|
||||
| CombineInventory {_subInvSel :: Maybe Int, _subInvRegex :: String
|
||||
, _subInvRegexInput :: Bool}
|
||||
| ExamineInventory {_subInvMSel :: Maybe Int}
|
||||
| CombineInventory {_subInvMap :: SelectionIntMap CombinableItem}
|
||||
| LockedInventory
|
||||
| DisplayTerminal {_termID :: Int}
|
||||
-- deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
@@ -6,6 +6,7 @@ module Dodge.Data.SelectionList where
|
||||
import Color
|
||||
import Control.Lens
|
||||
import Dodge.Data.CardinalPoint
|
||||
import Data.IntMap.Strict (IntMap)
|
||||
--import Data.Aeson
|
||||
--import Data.Aeson.TH
|
||||
|
||||
@@ -25,6 +26,17 @@ data SelectionList a = SelectionList
|
||||
, _slLength :: Int
|
||||
, _slRegex :: String
|
||||
, _slRegexInput :: Bool
|
||||
, _slRegexList :: [(SelectionItem a, Maybe Int)]
|
||||
}
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
data SelectionIntMap a = SelectionIntMap
|
||||
{ _smItems :: [SelectionItem a]
|
||||
, _smSelPos :: Maybe Int
|
||||
, _smLength :: Int
|
||||
, _smRegex :: String
|
||||
, _smRegexInput :: Bool
|
||||
, _smShownItems :: IntMap (SelectionItem a)
|
||||
}
|
||||
--deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
@@ -44,7 +56,7 @@ data SelectionItem a = SelectionItem
|
||||
, _siOffX :: Int
|
||||
, _siPayload :: a
|
||||
}
|
||||
| SelectionFilter
|
||||
| SelectionInfo
|
||||
{ _siPictures :: [String]
|
||||
, _siHeight :: Int
|
||||
, _siIsSelectable :: Bool
|
||||
@@ -57,5 +69,6 @@ data SelectionItem a = SelectionItem
|
||||
makeLenses ''ListDisplayParams
|
||||
makeLenses ''SelectionList
|
||||
makeLenses ''SelectionItem
|
||||
makeLenses ''SelectionIntMap
|
||||
--deriveJSON defaultOptions ''SelectionItem
|
||||
--deriveJSON defaultOptions ''SelectionList
|
||||
|
||||
Reference in New Issue
Block a user