From 97a5c61f28ba98728bab390e0ea745edfbea7103 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 30 Nov 2019 15:00:39 -0500 Subject: Fix an injectivity issue with saving the game Fix an injectivity issue with JSON-encoding the entity map that was causing the game saving to not properly round-trip. As part of this, there's a refactor to the internals of the entity map to use sets instead of vectors, which should also get us a nice perf boost. --- src/Xanthous/Entities/RawTypes.hs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Xanthous/Entities/RawTypes.hs') diff --git a/src/Xanthous/Entities/RawTypes.hs b/src/Xanthous/Entities/RawTypes.hs index f715f8743ab1..822b93f2dfe1 100644 --- a/src/Xanthous/Entities/RawTypes.hs +++ b/src/Xanthous/Entities/RawTypes.hs @@ -40,7 +40,7 @@ data CreatureType = CreatureType , _friendly :: !Bool , _speed :: !TicksPerTile } - deriving stock (Show, Eq, Generic) + deriving stock (Show, Eq, Ord, Generic) deriving anyclass (NFData, CoArbitrary, Function) deriving (ToJSON, FromJSON) via WithOptions '[ FieldLabelModifier '[Drop 1] ] @@ -56,7 +56,7 @@ data EdibleItem = EdibleItem { _hitpointsHealed :: Int , _eatMessage :: Maybe Message } - deriving stock (Show, Eq, Generic) + deriving stock (Show, Eq, Ord, Generic) deriving anyclass (NFData, CoArbitrary, Function) deriving (ToJSON, FromJSON) via WithOptions '[ FieldLabelModifier '[Drop 1] ] @@ -73,7 +73,7 @@ data ItemType = ItemType , _char :: EntityChar , _edible :: Maybe EdibleItem } - deriving stock (Show, Eq, Generic) + deriving stock (Show, Eq, Ord, Generic) deriving anyclass (NFData, CoArbitrary, Function) deriving (ToJSON, FromJSON) via WithOptions '[ FieldLabelModifier '[Drop 1] ] -- cgit 1.4.1