Bug(?): Re-definition of alternative sprites is not treated as an error but has no productive use

Open
#372 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
compilers

Research direction

Reproduce the duplicate alternative_sprites definitions in test.nml, using the same zoom level and bit depth shown in the report. Start from the alternative_sprites handling and its existing warning, then verify that this duplicate case produces an error rather than an override warning.

Written by the indexing model from the issue text.

Description

NML warns when alternative_sprites with the same zoom level and bit depth are defined twice, and overwrites the earlier definition with the later definition. However, there is never(?) a productive use of this behaviour, as alternative sprites are effectively part of the real sprite, so can't be redefined without redefining the entire real sprite.

replace grid_temperate_spr3981(3981, "temperate_groundtiles_gridline_8bpp.png") { template_groundtiles(0, 0, 1) }
alternative_sprites (grid_temperate_spr3981, ZOOM_LEVEL_NORMAL, BIT_DEPTH_32BPP, "temperate_groundtiles_gridline_bt32bpp.png") { template_groundtiles(0, 0, 1) }
alternative_sprites (grid_temperate_spr3981, ZOOM_LEVEL_NORMAL, BIT_DEPTH_32BPP, "arctic_groundtiles_gridline_bt32bpp.png") { template_groundtiles(0, 0, 1) }

Gives a warning like:

nmlc warning: "test.nml", line 47: Sprites are already defined for replace-block 'grid_temperate_spr3981' for this zoom level / bit depth combination. This data will be overridden.

This is reported as a warning at the same level as the 8bpp sprites containing white or animated pixels. However, as there are no(?) valid uses for redefining an alternative sprite set then it should probably be an error.

Dominant language
Python
Stars
61
Forks
47
Avg merge
8d 14h
Merged PRs (30d)
3

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OpenTTD/nml

All issues in OpenTTD/nml

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.