AlexHeyman / TiledReader

A simple Java library for reading Tiled files
https://www.alexheyman.org/tiledreader/
BSD 3-Clause "New" or "Revised" License
6 stars 3 forks source link

Fix crash on empty terrain types in tile data #3

Closed Toboi closed 4 years ago

Toboi commented 4 years ago

When reading a tileset with terrain types, the xml file has entries like <tile id="1" terrain="1,2,1,0"/>, which defines the terrain type for each corner of each tile. If a corner has no terrain type set, it is omitted like this: <tile id="1" terrain=",,,0"/>, on which the current implementation of TiledReader throws a javax.xml.stream.XMLStreamException: (line 8, column 31): Value of <tile> tag's terrain attribute (,,,0) contains a non-integer value.

This PR fixes this, so that the file is read without exception and empty terrain types are represented by null in the TiledTile's terrainTypes array.

AlexHeyman commented 4 years ago

Thanks for finding and fixing this.