Skip to content

Commit f6fb09a

Browse files
committed
Add: action0 prop 21 for rail stations
1 parent 2fefac5 commit f6fb09a

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

nml/actions/action0properties.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,10 +818,15 @@ def station_tile_flags(value):
818818
]
819819

820820

821-
def station_minimum_bridge_height(value):
822-
if not isinstance(value, Array):
823-
raise generic.ScriptError("Flag list must be an array", value.pos)
824-
return [VariableByteListProp(0x20, [[flags.reduce_constant().value for flags in value.values]], True)]
821+
def array_for_station_properties(prop_num, list_type="Flag"):
822+
def __call__(value):
823+
if not isinstance(value, Array):
824+
raise generic.ScriptError(list_type + " list must be an array", value.pos)
825+
if len(value.values) % 2 != 0:
826+
generic.print_warning(generic.Warning.GENERIC, list_type + " list does not have even length", 0)
827+
return [VariableByteListProp(prop_num, [[flags.reduce_constant().value for flags in value.values]], True)]
828+
829+
return __call__
825830

826831

827832
# fmt: off
@@ -849,7 +854,8 @@ def station_minimum_bridge_height(value):
849854
"name": {"size": 2, "num": (256, -1, 0x1C), "string": (256, 0xC5, 0xDC), "required": True},
850855
"classname": {"size": 2, "num": (256, -1, 0x1D), "string": (256, 0xC4, 0xDC)},
851856
"tile_flags": {"custom_function": station_tile_flags}, # = prop 1E
852-
"minimum_bridge_height": {"custom_function": station_minimum_bridge_height}, # = prop 20
857+
"minimum_bridge_height": {"custom_function": array_for_station_properties(0x20, list_type="Bridge heights")},
858+
"bridge_pillars_flags": {"custom_function": array_for_station_properties(0x21)},
853859
}
854860
# fmt: on
855861

0 commit comments

Comments
 (0)