mirror of
https://github.com/OMGeeky/pytiled_parser.git
synced 2026-02-23 15:49:52 +01:00
Fixes for bugs found in student .tmx files that cause crashes.
This commit is contained in:
@@ -192,7 +192,10 @@ def _parse_layer(
|
|||||||
else:
|
else:
|
||||||
id_ = None
|
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: Optional[objects.OrderedPair]
|
||||||
offset_x_attrib = layer_element.attrib.get("offsetx")
|
offset_x_attrib = layer_element.attrib.get("offsetx")
|
||||||
@@ -598,9 +601,13 @@ def _parse_tiles(
|
|||||||
location=(my_x, my_y),
|
location=(my_x, my_y),
|
||||||
size=(my_width, my_height))
|
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:
|
if my_object is None:
|
||||||
my_object = objects.RectangleObject(id_=my_id,
|
my_object = objects.RectangleObject(id_=my_id,
|
||||||
location=(my_x, my_y),
|
location=(my_x, my_y),
|
||||||
size=(my_width, my_height))
|
size=(my_width, my_height))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user