@@ -818,10 +818,20 @@ 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 : int , list_type : str , prefered_size : int , invert_function : callable ):
822+ def generated_function (value ):
823+ if isinstance (value , ConstantNumeric ):
824+ value = Array ([value , invert_function (value )] * prefered_size , value .pos )
825+ if not isinstance (value , Array ):
826+ raise generic .ScriptError (f"{ list_type } list must be an array" , value .pos )
827+ if len (value .values ) % 2 != 0 :
828+ generic .print_warning (generic .Warning .GENERIC , f"{ list_type } list does not have even length" , 0 )
829+ return [VariableByteListProp (prop_num , [[flags .reduce_constant ().value for flags in value .values ]], True )]
830+
831+ return generated_function
832+
833+
834+
825835
826836
827837# fmt: off
@@ -849,7 +859,8 @@ def station_minimum_bridge_height(value):
849859 "name" : {"size" : 2 , "num" : (256 , - 1 , 0x1C ), "string" : (256 , 0xC5 , 0xDC ), "required" : True },
850860 "classname" : {"size" : 2 , "num" : (256 , - 1 , 0x1D ), "string" : (256 , 0xC4 , 0xDC )},
851861 "tile_flags" : {"custom_function" : station_tile_flags }, # = prop 1E
852- "minimum_bridge_height" : {"custom_function" : station_minimum_bridge_height }, # = prop 20
862+ "minimum_bridge_height" : {"custom_function" : array_for_station_properties (0x20 , "Bridge heights" , 10 , lambda v : v )},
863+ "bridge_pillars_flags" : {"custom_function" : array_for_station_properties (0x21 , "Flag" , 10 , lambda v : v )},
853864}
854865# fmt: on
855866
0 commit comments