Skip to content

Commit

Permalink
Merge 7ed7bfd into 18d39a8
Browse files Browse the repository at this point in the history
  • Loading branch information
fjpena committed Aug 13, 2015
2 parents 18d39a8 + 7ed7bfd commit 474dc3e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tmxlib/fileio.py
Expand Up @@ -273,6 +273,7 @@ def tileset_from_element(self, cls, elem, base_path):
image=None,
)
tileset._read_first_gid = int(elem.attrib.pop('firstgid', 0))
tileset.tilecount = int(elem.attrib.pop('tilecount', 0))
assert not elem.attrib, (
'Unexpected tileset attributes: %s' % elem.attrib)
for subelem in elem:
Expand Down Expand Up @@ -535,8 +536,12 @@ def object_layer_from_element(self, cls, elem, map):
opacity=float(elem.attrib.pop('opacity', 1)),
visible=bool(int(elem.attrib.pop('visible', 1))),
color=color)
layer_size = (int(elem.attrib.pop('width')),
try:
layer_size = (int(elem.attrib.pop('width')),
int(elem.attrib.pop('height')))
except KeyError:
layer_size = map.size

assert layer_size == map.size
assert not elem.attrib, (
'Unexpected object layer attributes: %s' % elem.attrib)
Expand All @@ -549,6 +554,7 @@ def object_layer_from_element(self, cls, elem, map):
)
x = int(subelem.attrib.pop('x'))
y = int(subelem.attrib.pop('y'))
subelem_id = int(subelem.attrib.pop('id',0))

def put(attr_type, attr_name, arg_name):
attr = subelem.attrib.pop(attr_name, None)
Expand Down

0 comments on commit 474dc3e

Please sign in to comment.