OpenTTD/nml

Internal NMLC error with GRF using a switch parameter

2TallTyler opened this issue · 4 comments

I am building a house set which heavily uses switches with parameters as functions. All have worked fine, except for calculating the town population using the parent scope and a parameter for the population required to construct the building. This returns an internal NMLC error.

nmlc_error

I have attached a simple NML file which reproduces this error. Removing the parameter and changing the evaluation to a constant population >= 10 compiles fine.
error_grf.zip

I compiled my copy of NMLC late last fall, I believe around the end of November.

Can confirm.

store_tmp = VarAction2StoreCallParam(layout.register_map[parent_action.feature][i])

At that point, layout.register_map only contains key/feature 20

Not that I've any idea where 7 or 20 came from...

Feature 7 is Houses and feature 14 (20 dec) is towns

so NMLC gets confused that the "parent" of a house is a town

@frosch123 fixed this in #175.

Specifically it works after commit cf57433 "Fix: register_map must be accessed with the feature of the action, not with the scope of the variables."

Thanks! I'll update my NMLC.