Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions nml/actions/action0properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,12 @@ def station_tile_flags(value):
]


def station_tile_list(value, prop_num, description):
if not isinstance(value, Array) or len(value.values) % 2 != 0:
raise generic.ScriptError(f"{description} list must be an array of even length", value.pos)
return [VariableByteListProp(prop_num, [[x.reduce_constant().value for x in value.values]], True)]


# fmt: off
properties[0x04] = {
"class": {"size": 4, "num": 0x08, "first": None, "string_literal": 4},
Expand All @@ -855,6 +861,8 @@ def station_tile_flags(value):
"name": {"size": 2, "num": (256, -1, 0x1C), "string": (256, 0xC5, 0xDC), "required": True},
"classname": {"size": 2, "num": (256, -1, 0x1D), "string": (256, 0xC4, 0xDC)},
"tile_flags": {"custom_function": station_tile_flags}, # = prop 1E
"heights": {"custom_function": lambda x: station_tile_list(x, 0x20, "Station height")},
"blocked_pillars": {"custom_function": lambda x: station_tile_list(x, 0x21, "Station blocked pillar")},
}
# fmt: on

Expand Down Expand Up @@ -1668,5 +1676,7 @@ def byte_sequence_list(value, prop_num, description, expected_count):
"animation_triggers": {"size": 2, "num": 0x10},
# 11 (callback flags) is not set by user
"general_flags": {"size": 4, "num": 0x12},
"heights": {"custom_function": lambda x: station_tile_list(x, 0x13, "Station height")},
"blocked_pillars": {"custom_function": lambda x: station_tile_list(x, 0x14, "Station blocked pillar")},
"cost_multipliers": {"custom_function": lambda x: byte_sequence_list(x, 0x15, "Cost multipliers", 2)},
}
10 changes: 10 additions & 0 deletions nml/global_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,16 @@ def constant_number(name, info, pos):
# station tiles
"STAT_ALL_TILES" : 0xFF,

# bridge pillar flags
"BRIDGE_PILLAR_CORNER_W" : 0,
"BRIDGE_PILLAR_CORNER_S" : 1,
"BRIDGE_PILLAR_CORNER_E" : 2,
"BRIDGE_PILLAR_CORNER_N" : 3,
"BRIDGE_PILLAR_EDGE_NE" : 4,
"BRIDGE_PILLAR_EDGE_SE" : 5,
"BRIDGE_PILLAR_EDGE_SW" : 6,
"BRIDGE_PILLAR_EDGE_NW" : 7,

# house flags
"HOUSE_FLAG_NOT_SLOPED" : 1,
"HOUSE_FLAG_ANIMATE" : 5,
Expand Down
11 changes: 11 additions & 0 deletions regression/040_station.nml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,17 @@ item (FEAT_STATIONS, basic_station, 255) {
[6, 7]
],
];
heights: [1, 1, 2, 2, 3, 3, 4, 4];
blocked_pillars: [
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E),
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W),
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E),
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W),
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E, BRIDGE_PILLAR_EDGE_NE, BRIDGE_PILLAR_EDGE_NW),
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W, BRIDGE_PILLAR_EDGE_SE, BRIDGE_PILLAR_EDGE_SW),
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E, BRIDGE_PILLAR_EDGE_NE, BRIDGE_PILLAR_EDGE_NW),
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W, BRIDGE_PILLAR_EDGE_SE, BRIDGE_PILLAR_EDGE_SW),
];
}
graphics {
foundations: 0;
Expand Down
Binary file modified regression/expected/040_station.grf
Binary file not shown.
6 changes: 5 additions & 1 deletion regression/expected/040_station.nfo
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
4 * 16 00 08 \b1 02 FF \wx0000
09 "COAL" "LVST"

5 * 47 00 04 \b6 01 FF \wx00FF
5 * 71 00 04 \b8 01 FF \wx00FF
08 "TEST"
13 18
12 \dx00000002
Expand All @@ -35,6 +35,10 @@
04 04
06 06
\b0 \b0
20 FF \w8
01 01 02 02 03 03 04 04
21 FF \w8
0C 03 0C 03 9C 63 9C 63

6 * 11 04 04 FF 01 \wxC4FF "Test" 00

Expand Down