OpenTTD / OpenTTD/nml

A named parameter cannot be used for a house ID

Open
#300 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
58
Forks
46
Avg merge
11d 15h
Merged PRs (30d)
3

Description

A named parameter cannot be used for a house ID, instead throwing a Unrecognised identifier for the parameter name, for example:

house_id_1=5;
item(FEAT_HOUSES, item_house_1, house_id_1) {
    ...
}

Gives Unrecognised identifier for house_id_1. This seems like a bug:

"in theory it's supposed to work (https://github.com/OpenTTD/nml/blob/master/nml/ast/item.py#L55 looks for named params via https://github.com/OpenTTD/nml/blob/master/nml/global_constants.py#L1415), so it looks like a bug (but a hard to fix one I think"

"I guess it's similar to https://github.com/OpenTTD/nml/issues/299 check happens at parsing but the registration of house_id_1 is during preprocess step"

Contributor guide

No contributing guide indexed for this repository

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.

Research direction

Start with the reproduction in the issue, then read nml/ast/item.py around named-parameter lookup and nml/global_constants.py around the referenced registration. Trace when house_id_1 is checked during parsing versus registered during preprocessing. Done means the example accepts the named house ID without an Unrecognised identifier error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.