summaryrefslogtreecommitdiff
path: root/lib/CheckMap.hs
diff options
context:
space:
mode:
authorstuebinm2021-12-29 04:49:46 +0100
committerstuebinm2021-12-29 04:56:19 +0100
commit0419aa9918723c8b74252bf6ff1a2162c2f3a89a (patch)
tree6c793ecd95e1653024f4cb73675ab2a400c7221c /lib/CheckMap.hs
parent436a7dbb734f58a254bed6c9d28908033b537bf8 (diff)
maps, maps, and yet more maps
don't add maps to the result if their lint result looks the same as that of another list, just say it happened several times instead (this leads to a rather confusing Eq instance for MapResult which implements a very simple surface-level equality — perhaps change that later)
Diffstat (limited to 'lib/CheckMap.hs')
-rw-r--r--lib/CheckMap.hs18
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/CheckMap.hs b/lib/CheckMap.hs
index fead0b9..885ee70 100644
--- a/lib/CheckMap.hs
+++ b/lib/CheckMap.hs
@@ -21,20 +21,21 @@ import GHC.Generics (Generic)
import Badges (Badge)
-import LintConfig (LintConfig', LintConfig (configAssemblyTag))
+import LintConfig (LintConfig (configAssemblyTag), LintConfig')
import LintWriter (LintResult, invertLintResult,
resultToAdjusted, resultToBadges,
resultToDeps, resultToLints, resultToOffers,
runLintWriter)
import Properties (checkLayer, checkMap, checkTileset)
+import System.FilePath (takeFileName)
import Tiled (Layer (layerLayers, layerName),
LoadResult (..),
Tiledmap (tiledmapLayers, tiledmapTilesets),
loadTiledmap)
-import Types (Dep (MapLink), Hint (Hint, hintLevel, hintMsg),
- Level (..), lintsToHints)
+import Types (Dep (MapLink),
+ Hint (Hint, hintLevel, hintMsg), Level (..),
+ lintsToHints)
import Util (PrettyPrint (prettyprint), prettyprint)
-import System.FilePath (takeFileName)
@@ -56,6 +57,15 @@ data MapResult = MapResult
-- ^ general-purpose lints that didn't fit anywhere else
} deriving (Generic)
+
+instance Eq MapResult where
+ a == b =
+ mapresultLayer a == mapresultLayer b &&
+ mapresultTileset a == mapresultTileset b &&
+ -- mapresultBadges a == mapresultBadges b &&
+ mapresultGeneral a == mapresultGeneral b
+
+
instance ToJSON MapResult where
toJSON res = A.object
[ "layer" .= CollectedLints (mapresultLayer res)