mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.17k stars 1.76k forks source link

First GID property is always null when using TMXMapReader #2933

Open csueiras opened 3 years ago

csueiras commented 3 years ago

The first gid property is always null when using the TMXMapReader, the older MapReader used to set it in the buildMap method

tileset = readTileset(xmlPath + tileSetSource);
tileset.setFirstgid(firstGid);
tileset.setSource(tileSetSource);
tilesets.set(i, tileset);

I'll create a PR to also set this property in the TMXMapReader.

bjorn commented 3 years ago

The first gid property is always null when using the TMXMapReader, the older MapReader used to set it in the buildMap method

Actually, TMXMapReader is the older reader, though it appears to be still used and has seen further changes after MapReader was introduced in e95050054df80ba871323feccdf73f973a79f875 (as part of #1637).

@mikepthomas Was the MapReader class supposed to replace TMXMapReader? Is there a reason to have both? Ideally we would only have a single reader class.

mikepthomas commented 3 years ago

Completely agree. MapReader was intended to replace TMXMapReader however it is using JaxB simplify the code to load the the map. JaxB was deprecated and removed in JDK 11 (However it is still available as an external dependecy) my preference would be to remove the MapReader I created and use the TMXMapReader

bjorn commented 3 years ago

Alright, let's remove MapReader again then. :-)

csueiras commented 3 years ago

Wouldn't this still be a bit of a fix since otherwise there's no way to access the firstgid property?