diff options
author | stuebinm | 2021-11-17 01:28:32 +0100 |
---|---|---|
committer | stuebinm | 2021-11-17 01:28:32 +0100 |
commit | 919f57bfb30ef2adda996bf708ba6d1f70c42945 (patch) | |
tree | 185741a26b5f0c95ad16d3f8ffa6f36afa6cc2ce | |
parent | a13383cf78a699a886f1c30e0689f8143a9c1e0b (diff) |
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.
-rw-r--r-- | lib/Tiled2.hs | 12 |
1 files changed, 6 insertions, 6 deletions
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 |