diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-10-11 00:52:01 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-10-11 00:52:01 +0300 |
commit | 7859fc67a9170e0060cb80da8ce28ced7d039001 (patch) | |
tree | 2606077de2ba73e6cd12e41eaa4b7b1b920c16cd /testxml/testxml.py | |
parent | a39937140636a59b6253d543e006b77e0cc853bb (diff) | |
download | evol-tools-7859fc67a9170e0060cb80da8ce28ced7d039001.tar.gz evol-tools-7859fc67a9170e0060cb80da8ce28ced7d039001.tar.bz2 evol-tools-7859fc67a9170e0060cb80da8ce28ced7d039001.tar.xz evol-tools-7859fc67a9170e0060cb80da8ce28ced7d039001.zip |
testxml: add detection for overlapped oversized tiles.
Diffstat (limited to 'testxml/testxml.py')
-rwxr-xr-x | testxml/testxml.py | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/testxml/testxml.py b/testxml/testxml.py index d9b1197..e5aacc6 100755 --- a/testxml/testxml.py +++ b/testxml/testxml.py @@ -978,7 +978,11 @@ def testEmitters(id, file, parentNode, src): def testItems(fileName, imgDir): global warnings, errors, safeDye print "Checking items.xml" - dom = minidom.parse(parentDir + fileName) + try: + dom = minidom.parse(parentDir + fileName) + except: + print "error: " + fileName + " corrupted" + return idset = set() oldId = None for node in dom.getElementsByTagName("item"): @@ -1490,6 +1494,7 @@ def testMap(file, path): str(mapHeight) + ": " + name, True) obj = testLayer(file, layer, name, width, height, obj, tilesMap) + testOverSizedTiles(obj, tilesMap, file) if fringe == None: showMsgFile(file, "missing fringe layer", True) @@ -1530,6 +1535,47 @@ def testMap(file, path): showLayerErrors(file, err1, "empty tile in all layers", True) +def testOverSizedTiles(layer, tiles, file): + global warnings + + if layer.name == "Fringe": + return + errList = [] + for x in range(0, layer.width): + for y in range(0, layer.height): + idx = ((y * layer.width) + x) * 4 + val = getLDV(layer.arr, idx) + if val == 0: + continue + + tile = findTileByGid(tiles, val) + if tile is None: + # now ignoring, this happend because layer parser + # not support includes + None + elif tile.tileWidth > 32 and x + 1 < layer.width: + for x2 in (x + 1, x + 1 + int(tile.width / 32)): + idx = ((y * layer.width) + x2) * 4 + val = getLDV(layer.arr, idx) + tile = findTileByGid(tiles, val) + if val > 0: + errList.append((x, y)) + warnings = warnings + 1 + if len(errList) == 0: + return + print "Oversized tile overlapped to next tile in layer " + layer.name + \ + ". Possible incorrect map drawing" + errStr = "" + k = 0 + for err in errList: + errStr = errStr + str(err) + ", " + k = k + 1 + if k > 100: + errStr = errStr + "..." + break + print errStr + + def testTiles(file, tilesMap): for firstGid in tilesMap: for gid2 in tilesMap: |