diff options
author | stuebinm | 2021-12-18 17:52:25 +0100 |
---|---|---|
committer | stuebinm | 2021-12-18 17:52:25 +0100 |
commit | aa897bb7e2ae257c2680521e6b1c1cad1237df53 (patch) | |
tree | 0ae2e1582349d4cf79f941bfb647acb2417c854b /lib/Properties.hs | |
parent | 96a3cc24b3b62e2e88b0d31e66204c16d20f2aa9 (diff) |
fixed parsing of tiled objects
(points behave slightly differntly than I thought)
Diffstat (limited to '')
-rw-r--r-- | lib/Properties.hs | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Properties.hs b/lib/Properties.hs index c057b63..a326e30 100644 --- a/lib/Properties.hs +++ b/lib/Properties.hs @@ -211,7 +211,7 @@ checkLayer = do forM_ (getProperties layer) checkObjectGroupProperty unless (layerName layer == "floorLayer") $ - when (null publicObjects || publicObjects == Just mempty) $ + when (null (layerObjects layer) || layerObjects layer == Just mempty) $ warn "objectgroup layer (which aren't the floorLayer) \ \are useless if they are empty." @@ -234,16 +234,17 @@ checkObjectProperty obj p@(Property name _) = case name of unwrapString p $ \str -> unwrapBadgeToken str $ \token -> do case obj of - ObjectPoint {..} -> - offersBadge (Badge token (BadgePoint objectX objectY)) - ObjectRectangle {..} -> - if isJust objectEllipse - then offersBadge - $ Badge token (BadgeRect objectX objectY objectWidth objectHeight) - else complain "ellipses are not supported." ObjectPolygon {} -> complain "polygons are not supported." ObjectPolyline {} -> complain "polylines are not supported." ObjectText {} -> complain "cannot use texts to define badge areas." + ObjectRectangle {..} -> + if objectEllipse == Just True + then complain "ellipses are not supported." + else offersBadge + $ Badge token $ case (objectWidth, objectHeight) of + (Just w, Just h) | w /= 0 && h /= 0 -> + BadgeRect objectX objectY w h + _ -> BadgePoint objectX objectY _ -> warn $ "unknown object property " <> prettyprint name <> "." |