diff options
Diffstat (limited to '')
-rw-r--r-- | lib/Util.hs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/Util.hs b/lib/Util.hs index 82d326f..5cf27e3 100644 --- a/lib/Util.hs +++ b/lib/Util.hs @@ -9,7 +9,7 @@ module Util where import Data.Aeson as Aeson import Data.Text (Text) import qualified Data.Text as T -import Tiled2 (PropertyValue(..)) +import Tiled2 (Layer (layerData), PropertyValue (..), mkTiledId) -- | haskell's many string types are FUN … showText :: Show a => a -> Text @@ -32,7 +32,7 @@ instance PrettyPrint Aeson.Value where instance PrettyPrint PropertyValue where prettyprint = \case - StrProp str -> str + StrProp str -> str BoolProp bool -> if bool then "true" else "false" -- | here since Unit is sometimes used as dummy type @@ -41,3 +41,9 @@ instance PrettyPrint () where printPretty :: PrettyPrint a => a -> IO () printPretty = putStr . T.unpack . prettyprint + + +layerIsEmpty :: Layer -> Bool +layerIsEmpty layer = case layerData layer of + Nothing -> True + Just d -> all ((==) $ mkTiledId 0) d |