summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorstuebinm2021-12-04 12:55:44 +0100
committerstuebinm2021-12-12 17:41:34 +0100
commitaa1e5ae5a2b553ef47269bb9ea87eeca1a8de262 (patch)
treee720d571e698386a0b2dacdc6d863ec27bfc7697 /lib
parentec9552b1d6ab303d54a8bbb8c93418f32fa29654 (diff)
lint individual tile properties
Diffstat (limited to 'lib')
-rw-r--r--lib/Properties.hs16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/Properties.hs b/lib/Properties.hs
index 5845a1b..c9c704a 100644
--- a/lib/Properties.hs
+++ b/lib/Properties.hs
@@ -128,13 +128,27 @@ checkTileset = do
$ forbid "property \"tilesetCopyright\" for tilesets must be set."
-- check individual tileset properties
- mapM_ checkTilesetProperty (fromMaybe [] $ tilesetProperties tileset)
+ mapM_ checkTilesetProperty (fromMaybe mempty $ tilesetProperties tileset)
+
+ -- check individual tile definitions
+ mapM_ checkTile (fromMaybe mempty $ tilesetTiles tileset)
where
checkTilesetProperty :: Property -> LintWriter Tileset
checkTilesetProperty p@(Property name _value) = case name of
"copyright" -> naiveEscapeProperty p
_ -> warn $ "unknown tileset property " <> prettyprint name
+ checkTile :: Tile -> LintWriter Tileset
+ checkTile tile = do
+ -- TODO: refused doubled IDs?
+ mapM_ checkTileProperty (fromMaybe mempty $ tileProperties tile)
+ where checkTileProperty :: Property -> LintWriter Tileset
+ checkTileProperty p@(Property name _) = case name of
+ "collides" -> isBool p
+ _ -> warn $ "uknown tile property " <> prettyprint name
+ <> " in tile with global id "
+ <> showText (tileId tile)
+
-- | collect lints on a single map layer
checkLayer :: LintWriter Layer