← 输入框|github.com|刷新
Skip to content

Resolve template tilesets in empty maps and nested layer groups - #87

Open
civilwarinfrance wants to merge 2 commits into
pythonarcade:developmentfrom
civilwarinfrance:fix/template-only-map-tilesets
Open

civilwarinfrance wants to merge 2 commits into
pythonarcade:developmentfrom
civilwarinfrance:fix/template-only-map-tilesets

Conversation

@civilwarinfrance

@civilwarinfrance civilwarinfrance commented Oct 27, 2026 •

Copy link
Copy Markdown

Template-supplied tilesets currently fail in two map layouts: a map without its own tilesets raises ValueError on the first import, while objects inside layer groups skip import/remapping altogether and keep unresolved template-local GIDs. The latter can select a different tile from the map.

Start the first imported tileset at GID 1 when needed, and visit nested layer groups when resolving template tile objects in both JSON and TMX parsers. Existing root-level allocation, shared-tileset reuse and map layer structure are preserved.

The integration test uses the existing templates with/without map tilesets and group depths 0, 1 and 3, checking GIDs, distinct imports, repeat reuse and image references. On the upstream base, 10 cases fail and 2 controls pass; all 12 pass with this fix. Full suite: 138 passed (96% coverage). Mypy passes 27 source files. Changed files pass Black; the new test passes Ruff. Repository-wide Ruff/Black findings match the original base (178 findings / six unrelated files). Tested on CPython 3.14/macOS ARM64.

AI assistance: implemented and tested with OpenAI Codex (GPT-6).

@civilwarinfrance civilwarinfrance changed the title Load template tile objects when the map has no tilesets Resolve template tilesets in empty maps and nested layer groups Oct 27, 2026
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