Skip to content

Commit db32983

Browse files
authored
Add: Station/RoadStop height and blocked pillar flag lists. (#388)
1 parent 6b266e3 commit db32983

File tree

5 files changed

+36
-1
lines changed

5 files changed

+36
-1
lines changed

nml/actions/action0properties.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -830,6 +830,12 @@ def station_tile_flags(value):
830830
]
831831

832832

833+
def station_tile_list(value, prop_num, description):
834+
if not isinstance(value, Array) or len(value.values) % 2 != 0:
835+
raise generic.ScriptError(f"{description} list must be an array of even length", value.pos)
836+
return [VariableByteListProp(prop_num, [[x.reduce_constant().value for x in value.values]], True)]
837+
838+
833839
# fmt: off
834840
properties[0x04] = {
835841
"class": {"size": 4, "num": 0x08, "first": None, "string_literal": 4},
@@ -855,6 +861,8 @@ def station_tile_flags(value):
855861
"name": {"size": 2, "num": (256, -1, 0x1C), "string": (256, 0xC5, 0xDC), "required": True},
856862
"classname": {"size": 2, "num": (256, -1, 0x1D), "string": (256, 0xC4, 0xDC)},
857863
"tile_flags": {"custom_function": station_tile_flags}, # = prop 1E
864+
"heights": {"custom_function": lambda x: station_tile_list(x, 0x20, "Station height")},
865+
"blocked_pillars": {"custom_function": lambda x: station_tile_list(x, 0x21, "Station blocked pillar")},
858866
}
859867
# fmt: on
860868

@@ -1668,5 +1676,7 @@ def byte_sequence_list(value, prop_num, description, expected_count):
16681676
"animation_triggers": {"size": 2, "num": 0x10},
16691677
# 11 (callback flags) is not set by user
16701678
"general_flags": {"size": 4, "num": 0x12},
1679+
"heights": {"custom_function": lambda x: station_tile_list(x, 0x13, "Station height")},
1680+
"blocked_pillars": {"custom_function": lambda x: station_tile_list(x, 0x14, "Station blocked pillar")},
16711681
"cost_multipliers": {"custom_function": lambda x: byte_sequence_list(x, 0x15, "Cost multipliers", 2)},
16721682
}

nml/global_constants.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,16 @@ def constant_number(name, info, pos):
385385
# station tiles
386386
"STAT_ALL_TILES" : 0xFF,
387387

388+
# bridge pillar flags
389+
"BRIDGE_PILLAR_CORNER_W" : 0,
390+
"BRIDGE_PILLAR_CORNER_S" : 1,
391+
"BRIDGE_PILLAR_CORNER_E" : 2,
392+
"BRIDGE_PILLAR_CORNER_N" : 3,
393+
"BRIDGE_PILLAR_EDGE_NE" : 4,
394+
"BRIDGE_PILLAR_EDGE_SE" : 5,
395+
"BRIDGE_PILLAR_EDGE_SW" : 6,
396+
"BRIDGE_PILLAR_EDGE_NW" : 7,
397+
388398
# house flags
389399
"HOUSE_FLAG_NOT_SLOPED" : 1,
390400
"HOUSE_FLAG_ANIMATE" : 5,

regression/040_station.nml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,17 @@ item (FEAT_STATIONS, basic_station, 255) {
135135
[6, 7]
136136
],
137137
];
138+
heights: [1, 1, 2, 2, 3, 3, 4, 4];
139+
blocked_pillars: [
140+
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E),
141+
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W),
142+
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E),
143+
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W),
144+
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E, BRIDGE_PILLAR_EDGE_NE, BRIDGE_PILLAR_EDGE_NW),
145+
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W, BRIDGE_PILLAR_EDGE_SE, BRIDGE_PILLAR_EDGE_SW),
146+
bitmask(BRIDGE_PILLAR_CORNER_N, BRIDGE_PILLAR_CORNER_E, BRIDGE_PILLAR_EDGE_NE, BRIDGE_PILLAR_EDGE_NW),
147+
bitmask(BRIDGE_PILLAR_CORNER_S, BRIDGE_PILLAR_CORNER_W, BRIDGE_PILLAR_EDGE_SE, BRIDGE_PILLAR_EDGE_SW),
148+
];
138149
}
139150
graphics {
140151
foundations: 0;
24 Bytes
Binary file not shown.

regression/expected/040_station.nfo

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
4 * 16 00 08 \b1 02 FF \wx0000
2222
09 "COAL" "LVST"
2323

24-
5 * 47 00 04 \b6 01 FF \wx00FF
24+
5 * 71 00 04 \b8 01 FF \wx00FF
2525
08 "TEST"
2626
13 18
2727
12 \dx00000002
@@ -35,6 +35,10 @@
3535
04 04
3636
06 06
3737
\b0 \b0
38+
20 FF \w8
39+
01 01 02 02 03 03 04 04
40+
21 FF \w8
41+
0C 03 0C 03 9C 63 9C 63
3842

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

0 commit comments

Comments
 (0)