Skip to content

Parse TMX object-reference properties as integer IDs - #84

Open
civilwarinfrance wants to merge 2 commits into
pythonarcade:developmentfrom
civilwarinfrance:fix/tmx-object-property-ids
Open

civilwarinfrance wants to merge 2 commits into
pythonarcade:developmentfrom
civilwarinfrance:fix/tmx-object-property-ids

Conversation

@civilwarinfrance

Copy link
Copy Markdown

TMX properties with type="object" currently fall through to string handling, while JSON properties preserve numeric IDs. A reference to object 2 therefore becomes "2", causing lookup in an integer-keyed object table to fail. Convert these values to integer IDs, including zero for an unset reference and references nested in class properties.

This follows the Tiled specification: https://doc.mapeditor.org/en/stable/reference/tmx-map-format/#property

All six regression cases fail upstream and pass with the fix. They cover zero, normal and large IDs, nested class properties, and loading a real temporary TMX map through parse_map and resolving the target object by ID. The full suite passes all 132 tests. Mypy, Ruff, flake8, Black, and isort checks pass.

AI-assisted by Codex (GPT-6); prepared and tested by the assistant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant