From 6e75f701f63f1915d442c6b13126b1c3a8e95876 Mon Sep 17 00:00:00 2001 From: stuebinm Date: Tue, 29 Oct 2024 01:44:31 +0100 Subject: tiled: relax requirement of objects' types --- tiled/Data/Tiled.hs | 10 +++++----- walint/Properties.hs | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tiled/Data/Tiled.hs b/tiled/Data/Tiled.hs index 99c5c9d..0c95e62 100644 --- a/tiled/Data/Tiled.hs +++ b/tiled/Data/Tiled.hs @@ -111,7 +111,7 @@ data Object = ObjectRectangle , objectHeight :: Maybe Double , objectEllipse :: Maybe Bool , objectPoint :: Maybe Bool - , objectType :: Text + , objectType :: Maybe Text } | ObjectPolygon { objectId :: Int @@ -124,7 +124,7 @@ data Object = ObjectRectangle , objectGid :: Maybe GlobalId , objectWidth :: Maybe Double , objectHeight :: Maybe Double - , objectType :: Text + , objectType :: Maybe Text , objectPolygon :: Vector Point } | ObjectPolyline @@ -138,7 +138,7 @@ data Object = ObjectRectangle , objectGid :: Maybe GlobalId , objectWidth :: Maybe Double , objectHeight :: Maybe Double - , objectType :: Text + , objectType :: Maybe Text , objectPolyline :: Vector Point } | ObjectText @@ -150,11 +150,11 @@ data Object = ObjectRectangle , objectY :: Double , objectRotation :: Double , objectGid :: Maybe GlobalId - , objectText :: A.Value + , objectText :: Maybe A.Value , objectWidth :: Maybe Double , objectHeight :: Maybe Double , objectEllipse :: Maybe Bool - , objectType :: Text + , objectType :: Maybe Text } deriving (Eq, Generic, Show, NFData) diff --git a/walint/Properties.hs b/walint/Properties.hs index 7b5a181..2f4e64a 100644 --- a/walint/Properties.hs +++ b/walint/Properties.hs @@ -270,7 +270,7 @@ checkObjectProperty p@(Property name _) = do unwrapURI (Proxy @"website") p (dependsOn . Link) (const $ forbid "using \"url\" to open local html files is disallowed.") - unless (objectType obj == "website") + unless (objectType obj == Just "website") $ complain "\"url\" can only be set for objects of type \"website\"" "getBadge" -> do when (1 /= length (getProperties obj)) @@ -305,7 +305,7 @@ checkObjectProperty p@(Property name _) = do -- extended API for doors and bells | name `elem` ["door", "bell"] -> do isBool p - unless (objectType obj == "variable") $ + unless (objectType obj == Just "variable") $ complain $ "the "<>prettyprint name<>" property should only be set \ \on objects of type \"variable\"" when (isNothing (objectName obj) || objectName obj == Just mempty) $ -- cgit v1.2.3