diff options
author | stuebinm | 2024-10-29 01:44:31 +0100 |
---|---|---|
committer | stuebinm | 2024-10-29 01:44:31 +0100 |
commit | 6e75f701f63f1915d442c6b13126b1c3a8e95876 (patch) | |
tree | d9296d718ca545170c5c08f8bfd90f5e8e08f8ec | |
parent | 31135ab11ba1133f723200003bf21d47f5a4d03e (diff) |
tiled: relax requirement of objects' types
-rw-r--r-- | tiled/Data/Tiled.hs | 10 | ||||
-rw-r--r-- | 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) $ |