Bug #8519

ActionD-linked crash when building with calculation for palette in spritelayout

Added by zephyris over 2 years ago.

Status:NewStart date:2018-01-01
Priority:NormalDue date:
Assignee:-% Done:


Target version:-


Using a calculation in palette assignment in a sprite layout for a house makes nmlc crash.
This example nml uses a sprite layout for a house which takes one parameter; a palette offset. The palette offset is used in the spritelayout to alter the palette that should be used, which I believe should generate valid nfo. Unfortunately it crashes nml!

An example grf

//Define the grf
grf {
    grfid: "ZDB\02";
    name: string(STR_GRF_NAME);
    desc: string(STR_GRF_DESC);
    version: 0;
    min_compatible_version: 0;

cargotable {PASS, GOOD, MAIL}

//Disable all buildings

//Debug house
//Sprite layout ***HERIN LIES THE ISSUE***
spritelayout layout_debug_house(palette_offset) {
   ground {
      recolour_mode: RECOLOUR_REMAP;
      palette: 795+palette_offset;

//The house itself
item(FEAT_HOUSES, item_house_detached) {
    property {
      substitute: 24;
      population: 12;
      mail_multiplier: 3;
      accepted_cargos: [[PASS, 2], [MAIL, 1]];
      local_authority_impact: 70;
      removal_cost_multiplier: 70;
      probability: 6;
      years_available: [1950, 3000];
      availability_mask: [ALL_TOWNZONES, ALL_CLIMATES];
    graphics {
        default: layout_debug_house(1);

The NML error

nmlc ERROR: nmlc: An internal error has occurred:
nmlc-version: 0.4.0.r5397:588fce355f96 from 2014-10-11
Error: (AssertionError) .
Command: ['nmlc', 'ActionDBug.nml']
Location: File "nml\actions\action2var.py", line 275, in supported_by_actionD

And the nmlc stack dump

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\cx_Freeze\initscripts\Console.py", line 27, in <module>
  File "nmlc", line 6, in <module>
  File "nml\main.py", line 342, in run
  File "nml\main.py", line 161, in main
  File "nml\main.py", line 220, in nml
  File "nml\ast\base_statement.py", line 154, in get_action_list
  File "nml\ast\spriteblock.py", line 233, in get_action_list
  File "nml\actions\action2layout.py", line 438, in get_layout_action2s
  File "nml\actions\actionD.py", line 160, in write_action_value
  File "nml\actions\actionD.py", line 126, in get_tmp_parameter
  File "nml\actions\actionD.py", line 313, in parse_actionD
  File "nml\expression\binop.py", line 179, in supported_by_actionD
  File "nml\actions\action2var.py", line 275, in supported_by_actionD

Also available in: Atom PDF