TiledCS icon indicating copy to clipboard operation
TiledCS copied to clipboard

Flipped objects throw an OverflowException on ParseXml

Open juanferrer opened this issue 2 years ago • 2 comments

ParseObjects doesn't check nor clear flip flags, so int.Parse throws an OverflowException when attempting to parse a flipped object.

Started making a pull request, but wasn't sure if you wanted another set of 6 functions called IsObjectFlipped... or adding three booleans to the object itself. So I'll leave the implementation to you =].

juanferrer avatar Aug 29 '22 21:08 juanferrer

Hey @juanferrer

Thanks for letting me know. Will have a look at it!

With kind regards, TheBoneJarmer

TheBoneJarmer avatar Aug 30 '22 06:08 TheBoneJarmer

Hey @juanferrer

I just published TiledCS 3.3.2. This includes a fix for the error you got as well as extra stuff to fetch the flipped state of a tile linked to an object. To start with, each object now has a field dataRotationFlag. This is similar to the TiledLayer.dataRotationFlags field.

And just like with tiles you can use the helper methods IsTileFlippedDiagonal, IsTileFlippedVertical and IsTileFlippedHorizontal. These now accept a parameter of type TiledObject. I'd say, give it a shot and let me know if it works for you. :)

With kind regards, TheBoneJarmer

TheBoneJarmer avatar Aug 30 '22 13:08 TheBoneJarmer

Didn't hear back so I assume all went well. If not do not hesitate to open up this issue again. :)

TheBoneJarmer avatar Sep 12 '22 21:09 TheBoneJarmer

Oh, sorry. Yes, my bad. The update fixed it. Thanks!

juanferrer avatar Sep 12 '22 21:09 juanferrer