Skip to content

Commit 461ce42

Browse files
committed
Add: bridge pillar flags
1 parent 55a3324 commit 461ce42

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

nml/actions/action0properties.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -831,7 +831,21 @@ def generated_function(value):
831831
return generated_function
832832

833833

834-
834+
def invert_bridge_pillars_flags(value):
835+
out = ConstantNumeric(0, value.pos)
836+
for i_flag, o_flag in [
837+
(global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_W"], global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_S"]),
838+
(global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_S"], global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_W"]),
839+
(global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_N"], global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_E"]),
840+
(global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_E"], global_constants.constant_numbers["BRIDGE_PILLAR_CORNER_N"]),
841+
(global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_NE"], global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_NE"]),
842+
(global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_SE"], global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_SW"]),
843+
(global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_SW"], global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_SE"]),
844+
(global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_NW"], global_constants.constant_numbers["BRIDGE_PILLAR_EDGE_NW"]),
845+
] :
846+
if value.value & (1 << i_flag):
847+
out.value += 1 << o_flag
848+
return out
835849

836850

837851
# fmt: off
@@ -860,7 +874,7 @@ def generated_function(value):
860874
"classname": {"size": 2, "num": (256, -1, 0x1D), "string": (256, 0xC4, 0xDC)},
861875
"tile_flags": {"custom_function": station_tile_flags}, # = prop 1E
862876
"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)},
877+
"bridge_pillars_flags": {"custom_function": array_for_station_properties(0x21, "Flag", 10, invert_bridge_pillars_flags)},
864878
}
865879
# fmt: on
866880

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,

0 commit comments

Comments
 (0)