diff --git a/nml/actions/action0properties.py b/nml/actions/action0properties.py index e7aa8b7c9..8e91963b0 100644 --- a/nml/actions/action0properties.py +++ b/nml/actions/action0properties.py @@ -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}, @@ -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 @@ -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)}, } diff --git a/nml/global_constants.py b/nml/global_constants.py index 9febe589c..7bf9f38c4 100644 --- a/nml/global_constants.py +++ b/nml/global_constants.py @@ -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, diff --git a/regression/040_station.nml b/regression/040_station.nml index 75fdd4826..6b79f4849 100644 --- a/regression/040_station.nml +++ b/regression/040_station.nml @@ -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; diff --git a/regression/expected/040_station.grf b/regression/expected/040_station.grf index 40a8a745b..34da80f9d 100644 Binary files a/regression/expected/040_station.grf and b/regression/expected/040_station.grf differ diff --git a/regression/expected/040_station.nfo b/regression/expected/040_station.nfo index f08681935..cdcedcb1b 100644 --- a/regression/expected/040_station.nfo +++ b/regression/expected/040_station.nfo @@ -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 @@ -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