diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-11-15 00:03:01 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-12-16 22:28:32 +0100 |
commit | 46bd2f1cedde365218a3f1a52116fe169587af89 (patch) | |
tree | 633af4662d44346fc74abe4646b22c01df42e78a /src/script/api/script_road.cpp | |
parent | 55170ae703dd2f55ae5c2151aa97dd12da1e917e (diff) | |
download | openttd-46bd2f1cedde365218a3f1a52116fe169587af89.tar.xz |
Codechange: Un-bitstuff remaining transport infrastructure commands.
Diffstat (limited to 'src/script/api/script_road.cpp')
-rw-r--r-- | src/script/api/script_road.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/script/api/script_road.cpp b/src/script/api/script_road.cpp index c629396b7..297a8f56c 100644 --- a/src/script/api/script_road.cpp +++ b/src/script/api/script_road.cpp @@ -129,7 +129,7 @@ EnforcePrecondition(false, ::IsValidTile(end_tile)); EnforcePrecondition(false, IsRoadTypeAvailable(road_type)); - return ScriptObject::Command<CMD_CONVERT_ROAD>::Do(start_tile, end_tile, (::RoadType)road_type, {}); + return ScriptObject::Command<CMD_CONVERT_ROAD>::Do(start_tile, end_tile, (::RoadType)road_type); } /* Helper functions for ScriptRoad::CanBuildConnectedRoadParts(). */ @@ -495,7 +495,8 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD EnforcePrecondition(false, !one_way || RoadTypeIsRoad(ScriptObject::GetRoadType())); EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType())); - return ScriptObject::Command<CMD_BUILD_LONG_ROAD>::Do(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (((start < end) == !full) ? 1 : 2) | (ScriptObject::GetRoadType() << 3) | ((one_way ? 1 : 0) << 10) | 1 << 11, {}); + Axis axis = ::TileY(start) != ::TileY(end) ? AXIS_Y : AXIS_X; + return ScriptObject::Command<CMD_BUILD_LONG_ROAD>::Do(start, end, ScriptObject::GetRoadType(), axis, one_way ? DRD_NORTHBOUND : DRD_NONE, (start < end) == !full, (start < end) != !full, true); } /* static */ bool ScriptRoad::BuildRoad(TileIndex start, TileIndex end) @@ -570,7 +571,7 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end)); EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType())); - return ScriptObject::Command<CMD_REMOVE_LONG_ROAD>::Do(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 1 : 2) | (ScriptObject::GetRoadType() << 3), {}); + return ScriptObject::Command<CMD_REMOVE_LONG_ROAD>::Do(start, end, ScriptObject::GetRoadType(), ::TileY(start) != ::TileY(end) ? AXIS_Y : AXIS_X, start < end, start >= end); } /* static */ bool ScriptRoad::RemoveRoadFull(TileIndex start, TileIndex end) @@ -582,7 +583,7 @@ static bool NeighbourHasReachableRoad(::RoadType rt, TileIndex start_tile, DiagD EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end)); EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType())); - return ScriptObject::Command<CMD_REMOVE_LONG_ROAD>::Do(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 2 : 1) | (ScriptObject::GetRoadType() << 3), {}); + return ScriptObject::Command<CMD_REMOVE_LONG_ROAD>::Do(start, end, ScriptObject::GetRoadType(), ::TileY(start) != ::TileY(end) ? AXIS_Y : AXIS_X, start >= end, start < end); } /* static */ bool ScriptRoad::RemoveRoadDepot(TileIndex tile) |