Use NewIntMap InvInt for crInv

This commit is contained in:
2025-08-25 10:21:59 +01:00
parent 25e64d5378
commit 3f6f1b4019
38 changed files with 437 additions and 406 deletions
+4 -3
View File
@@ -17,6 +17,7 @@ module Dodge.Data.Creature (
module Dodge.Data.Item.Use.Consumption.LoadAction,
) where
import NewInt
import Dodge.Data.Item.Use.Consumption.LoadAction
import Dodge.Data.Equipment.Misc
import Control.Lens
@@ -32,7 +33,7 @@ import Dodge.Data.Creature.State
import Dodge.Data.Item
import Dodge.Data.Material
import Geometry.Data
import qualified IntMapHelp as IM
--import qualified IntMapHelp as IM
data Creature = Creature
{ _crPos :: Point2
@@ -45,9 +46,9 @@ data Creature = Creature
, _crType :: CreatureType
, _crID :: Int
, _crHP :: Int
, _crInv :: IM.IntMap Int
, _crInv :: NewIntMap InvInt Int
, _crManipulation :: Manipulation
, _crEquipment :: M.Map EquipSite Int
, _crEquipment :: M.Map EquipSite (NewInt InvInt)
, _crDamage :: [Damage]
, _crPain :: Int
, _crStance :: Stance
+3 -6
View File
@@ -5,6 +5,7 @@
{-# LANGUAGE EmptyDataDeriving #-}
module Dodge.Data.Item.Location where
import NewInt
import ShortShow
import Dodge.Data.Equipment.Misc
import Control.Lens
@@ -13,9 +14,6 @@ import Data.Aeson.TH
-- it would be nice to have these as empty types, but I'm not sure how to get
-- aeson to handle that
data FloorInt = FloorInt
deriving (Eq,Ord,Show,Read)
-- should use these..
data InvInt = InvInt
deriving (Eq,Ord,Show,Read)
data TurretInt
@@ -28,7 +26,7 @@ data ItmInt = ItmInt
data ItemLocation
= InInv
{ _ilCrID :: Int
, _ilInvID :: Int
, _ilInvID :: NewInt InvInt
, _ilIsRoot :: Bool -- of any item
, _ilIsSelected :: Bool
, _ilIsAttached :: Bool -- to selected item
@@ -41,7 +39,7 @@ data ItemLocation
instance ShortShow ItemLocation where
shortShow (InInv cid invid rootb selb attb esite)
= "InInv:cid" <> shortShow cid <> "invid"<> shortShow invid
= "InInv:cid" <> shortShow cid <> "invid"<> shortShow (_unNInt invid)
<>"root"<>shortShow rootb<>"sel"<>shortShow selb<>"att"<>shortShow attb<>
shortShow (fmap (SString . show) esite)
shortShow x = show x
@@ -51,7 +49,6 @@ instance ShortShow ItemLocation where
makeLenses ''ItemLocation
deriveJSON defaultOptions ''InvInt
deriveJSON defaultOptions ''FloorInt
deriveJSON defaultOptions ''ItemLocation
deriveJSON defaultOptions ''ItmInt
deriveJSON defaultOptions ''CrInt
@@ -5,6 +5,8 @@
module Dodge.Data.Item.Use.Consumption.LoadAction where
import Dodge.Data.Item.Location
import NewInt
import qualified Data.IntSet as IS
import Control.Lens
import Data.Aeson
@@ -20,9 +22,9 @@ data Manipulation -- should be ManipulatedObject?
data ManipulatedObject
= SortInventory
| SelectedItem
{ _imSelectedItem :: Int -- this should probably be the itmid, not the invid
, _imRootSelectedItem :: Int
, _imAttachedItems :: IS.IntSet
{ _imSelectedItem :: NewInt InvInt
, _imRootSelectedItem :: NewInt InvInt
, _imAttachedItems :: IS.IntSet -- this should probably be NewIntSet InvInt also
}
| SelNothing
| SortCloseItem
+4 -2
View File
@@ -5,6 +5,8 @@
module Dodge.Data.RightButtonOptions where
import Dodge.Data.Item.Location
import NewInt
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -27,11 +29,11 @@ data EquipmentAllocation
| SwapEquipment
{ _allocNewPos :: EquipSite
, _allocOldPos :: EquipSite
, _allocSwapID :: Int
, _allocSwapID :: NewInt InvInt
}
| ReplaceEquipment
{ _allocNewPos :: EquipSite
, _allocRemoveID :: Int
, _allocRemoveID :: NewInt InvInt
}
| RemoveEquipment
{ _allocOldPos :: EquipSite
+3 -1
View File
@@ -5,6 +5,8 @@
module Dodge.Data.WorldEffect where
import Dodge.Data.Item.Location
import NewInt
import Dodge.Data.LightSource
import Data.Aeson
import Data.Aeson.TH
@@ -31,7 +33,7 @@ data WdWd
-- | WdWdFromItCrixWdWd (LabelDoubleTree ComposeLinkType Item) Int ItCrWdWd
| MakeTempLight LSParam Int
| UseInvItem Int Int -- invid presstime
| WdWdBurstFireRepetition Int Int
| WdWdBurstFireRepetition Int (NewInt InvInt)
--deriving (Eq, Show, Read) --, Generic)
--h--deriving (Eq, Show, Read) --Generic, Flat)