Skip to content
Snippets Groups Projects
Commit c89872d3 authored by stuebinm's avatar stuebinm
Browse files

suggest setting map meta properties if not given

parent 417087b1
No related branches found
No related tags found
No related merge requests found
Pipeline #9725 passed
......@@ -27,6 +27,7 @@ import Badges (Badge (Badge),
parseToken)
import Data.Data (Proxy (Proxy))
import Data.Functor ((<&>))
import Data.List ((\\))
import Data.Maybe (fromMaybe, isJust)
import Data.Set (Set)
import qualified Data.Set as S
......@@ -83,6 +84,14 @@ checkMap = do
whenLayerCollisions layers (\(Property name _) -> name == "exitUrl" || name == "startLayer")
$ \cols -> warn $ "collisions between entry and / or exit layers: " <> prettyprint cols
let missingMetaInfo =
["mapName","mapDescription","mapLink","mapImage"]
\\ fmap getName (getProperties tiledmap)
unless (null missingMetaInfo)
$ suggest $ "consider adding meta information to your map using the "
<> prettyprint missingMetaInfo <> " properties."
where
-- recursively find all layers (to deal with nested group layers)
collectLayers :: Tiledmap -> V.Vector Layer
......
......@@ -39,13 +39,14 @@ instance PrettyPrint Aeson.Value where
v -> (T.pack . show) v
instance PrettyPrint t => PrettyPrint (Set t) where
prettyprint = T.intercalate ", " . fmap prettyprint . S.toList
prettyprint = prettyprint . S.toList
instance PrettyPrint PropertyValue where
prettyprint = \case
StrProp str -> str
BoolProp bool -> if bool then "true" else "false"
IntProp int -> showText int
FloatProp float -> showText float
-- | here since Unit is sometimes used as dummy type
instance PrettyPrint () where
......@@ -57,6 +58,9 @@ instance PrettyPrint Layer where
instance PrettyPrint Tileset where
prettyprint = (<>) "tileset " . tilesetName
instance PrettyPrint a => PrettyPrint [a] where
prettyprint = T.intercalate ", " . fmap prettyprint
printPretty :: PrettyPrint a => a -> IO ()
printPretty = putStr . T.unpack . prettyprint
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment