From 919f57bfb30ef2adda996bf708ba6d1f70c42945 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Wed, 17 Nov 2021 01:28:32 +0100 Subject: map format: turns out more things are optional the unhelpfulness of the spec is slowly starting to grate … Anyways, apparently a lot more properties don't have to be present, and you find out by finding maps somewhere that work but currently fail the parser. --- lib/Tiled2.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lib') diff --git a/lib/Tiled2.hs b/lib/Tiled2.hs index 5b37f20..2c5f55e 100644 --- a/lib/Tiled2.hs +++ b/lib/Tiled2.hs @@ -97,13 +97,13 @@ data Object = Object { objectId :: Int -- ^ Width in pixels. Ignored if using a gid. , objectHeight :: Double -- ^ Height in pixels. Ignored if using a gid. - , objectName :: String + , objectName :: Maybe String -- ^ String assigned to name field in editor , objectType :: String -- ^ String assigned to type field in editor - , objectProperties :: Map Text Text + , objectProperties :: Maybe Value -- ^ String key-value pairs - , objectVisible :: Bool + , objectVisible :: Maybe Bool -- ^ Whether object is shown in editor. , objectX :: Double -- ^ x coordinate in pixels @@ -113,13 +113,13 @@ data Object = Object { objectId :: Int -- ^ Angle in degrees clockwise , objectGid :: Maybe GlobalId -- ^ GID, only if object comes from a Tilemap - , objectEllipse :: Bool + , objectEllipse :: Maybe Bool -- ^ Used to mark an object as an ellipse , objectPolygon :: Maybe (Vector (Double, Double)) -- ^ A list of x,y coordinates in pixels , objectPolyline :: Maybe (Vector (Double, Double)) -- ^ A list of x,y coordinates in pixels - , objectText :: Map Text Text + , objectText :: Maybe Value -- ^ String key-value pairs } deriving (Eq, Generic, Show) @@ -276,7 +276,7 @@ instance ToJSON Tileset where -- | The full monty. -data Tiledmap = Tiledmap { tiledmapVersion :: Float +data Tiledmap = Tiledmap { tiledmapVersion :: Value -- ^ The JSON format version , tiledmapTiledversion :: String -- ^ The Tiled version used to save the file -- cgit v1.2.3