mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2025-12-28 15:22:28 +01:00
Merge pull request #9 from pvcraven/master
Fixes for bugs found in student .tmx files that cause crashes.
This commit is contained in:
@@ -197,7 +197,10 @@ def _parse_layer(
|
||||
else:
|
||||
id_ = None
|
||||
|
||||
name = layer_element.attrib["name"]
|
||||
if "name" in layer_element.attrib:
|
||||
name = layer_element.attrib["name"]
|
||||
else:
|
||||
name = None
|
||||
|
||||
offset: Optional[objects.OrderedPair]
|
||||
offset_x_attrib = layer_element.attrib.get("offsetx")
|
||||
@@ -603,9 +606,13 @@ def _parse_tiles(
|
||||
location=(my_x, my_y),
|
||||
size=(my_width, my_height))
|
||||
|
||||
if my_object is None:
|
||||
if "template" in object.attrib:
|
||||
print("Warning, this .tmx file is using an unsupported 'template' attribute. Ignoring.")
|
||||
continue
|
||||
|
||||
if my_object is None:
|
||||
my_object = objects.RectangleObject(id_=my_id,
|
||||
my_object = objects.RectangleObject(id_=my_id,
|
||||
location=(my_x, my_y),
|
||||
size=(my_width, my_height))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user