Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

TmxFile2D: Fix determination of object type #850

Merged
merged 1 commit into from
Aug 20, 2015

Conversation

bjorn
Copy link
Contributor

@bjorn bjorn commented Aug 19, 2015

TmxObjectGroup2D::Load was using the presence of the "width" and "height" attributes for deciding whether an object was a rectangle, ellipse or something else. This approach breaks for maps saved in more recent versions of Tiled. This is because the width and height are only saved when they differ from the default (0), and because the width and height are now also used to store the size of tile objects.

So for maps saved with Tiled >= 0.12, this change:

  • Fixes identification of rectangle and ellipse objects with 0 width and height (which was leading to the entire map failing to load).
  • Fixes identification of tile objects.

TmxObjectGroup2D::Load was using the presence of the "width" and
"height" attributes for deciding whether an object was a rectangle,
ellipse or something else. This is wrong, and the approach breaks for
maps saved in more recent versions of Tiled. This is because the width
and height are only saved when they differ from the default (0), and
because the width and height are now also used to store the size of tile
objects.

So for maps saved with Tiled >= 0.12, this change:

* Fixes identification of rectangle and ellipse objects with 0 width and
  height (which was leading to the entire map failing to load).
* Fixes identification of tile objects.
@cadaver
Copy link
Contributor

cadaver commented Aug 20, 2015

Thanks, nice to get a fix from the author himself!

@bjorn
Copy link
Contributor Author

bjorn commented Aug 20, 2015

We needed this fix for LucKeyProductions/KO, a game my brother is working on and I was helping him integrate Tiled for level editing. :-)

I consider the issue here somewhat my fault, for making the TMX format a little confusing. It happened due to the continuous adding of unanticipated features. It's hard to describe all these details and unfortunately the sheer amount of TMX support libraries out there are almost consistently out of date.

Maybe I'll have more changes later. :-)

@cadaver cadaver merged commit 094d146 into urho3d:master Aug 20, 2015
@weitjong weitjong modified the milestone: 1.5 Nov 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants