Skip to content

Commit

Permalink
Add detection when a map contains a reference to a tileset that does …
Browse files Browse the repository at this point in the history
…not exist. This is serious so exit process.
  • Loading branch information
dbakewel committed Jun 3, 2022
1 parent 36f2a3c commit 348e0ae
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/engine/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ def __init__(self, tilesets, mapDir):
name = ts['source'].split("/")[-1].split(".")[0]
self['tsFirstGid'][name] = ts['firstgid']

# Do some error checking to make sure all tilesets in map actually exist.
log(f"Map '{self['name']}' contains tilesets: {list(self['tsFirstGid'].keys())}", "VERBOSE")
for tilesetName in self['tsFirstGid']:
if tilesetName not in self['tilesets']:
log(f"Map '{self['name']}' uses a tileset '{tilesetName}', which does not exist!", "FAILURE")
exit()

# convert layer visibility data into a more compact form that is better for sending over network.
self['layerVisabilityMask'] = 0
Expand Down

0 comments on commit 348e0ae

Please sign in to comment.