Add newtype for item id int

This commit is contained in:
2024-09-28 23:34:32 +01:00
parent 241191ee1b
commit 7d72fa3c5d
14 changed files with 274 additions and 267 deletions
+2 -1
View File
@@ -16,6 +16,7 @@ module Dodge.Data.Item (
module Dodge.Data.Item.Location,
) where
import NewInt
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -36,7 +37,7 @@ data ItID = ItID
data Item = Item
{ _itUse :: ItemUse
, _itType :: ItemType
, _itID :: Int
, _itID :: NewInt ItmInt
, _itLocation :: ItemLocation
, _itEffect :: ItEffect
, _itInvSize :: Float
+4
View File
@@ -21,6 +21,8 @@ data TurretInt
deriving (Eq,Ord,Show,Read)
data CrInt = CrInt
deriving (Eq,Ord,Show,Read)
data ItmInt = ItmInt
deriving (Eq,Ord,Show,Read)
data ItemLocation
= InInv
@@ -39,3 +41,5 @@ makeLenses ''ItemLocation
deriveJSON defaultOptions ''InvInt
deriveJSON defaultOptions ''FloorInt
deriveJSON defaultOptions ''ItemLocation
deriveJSON defaultOptions ''ItmInt
deriveJSON defaultOptions ''CrInt
+5 -3
View File
@@ -9,6 +9,8 @@ module Dodge.Data.Item.Use.Consumption.Ammo (
module Dodge.Data.Payload,
) where
import Dodge.Data.Item.Location
import NewInt
import Control.Lens
import Data.Aeson
import Data.Aeson.TH
@@ -21,11 +23,11 @@ data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProject
data ProjectileUpdate
= ThrustPU {_pjuStart :: Int, _pjuEnd :: Int}
| StartSpinPU {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int, _pjuControllerID :: Maybe Int}
| RemoteDirectionPU {_pjuStart :: Int, _pjuEnd :: Int, _pjuControllerID :: Maybe (NewInt ItmInt)}
| ReduceSpinPU {_pjuReduceSpin :: Float}
| DestroyPU {_pjuScreenID :: Maybe Int, _pjuTimer :: Int}
| DestroyPU {_pjuScreenID :: Maybe (NewInt ItmInt), _pjuTimer :: Int}
| TimePU
| CollisionEffectPU {_pjuScreenID :: Maybe Int}
| CollisionEffectPU {_pjuScreenID :: Maybe (NewInt ItmInt)}
deriving (Show, Eq, Ord, Read) --Generic, Flat)
data AmmoType
+4 -3
View File
@@ -13,6 +13,7 @@ module Dodge.Data.World (
module Dodge.Data.Input,
) where
import NewInt
import Control.Lens
import Data.IntMap.Strict (IntMap)
import Data.IntSet (IntSet)
@@ -62,7 +63,7 @@ data TimeFlowStatus
{ _scrollSmoothing :: Int
, _reverseAmount :: Int
, _futureWorlds :: [LWorld]
, _scrollItemLocation :: Int
, _scrollItemID :: NewInt ItmInt
}
| CameraScrollTimeFlow
{ _scrollSmoothing :: Int
@@ -71,11 +72,11 @@ data TimeFlowStatus
}
| RewindLeftClick
{ _reverseAmount :: Int
, _scrollItemLocation :: Int
, _scrollItemID :: NewInt ItmInt
}
| PausedTimeFlow
{ _timeFlowCharge :: Int
, _scrollItemLocation :: Int
, _scrollItemID :: NewInt ItmInt
}
makeLenses ''TimeFlowStatus