summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJonathan G Rennison <j.g.rennison@gmail.com>2018-08-12 08:45:38 +0100
committerPatric Stout <truebrain@openttd.org>2018-08-12 09:45:38 +0200
commitd839526365e66b0846366807e2e697358819751c (patch)
tree20f390be095c055d367aa5761ff4762d3f46fcee /src
parent50d930298dd99d20022c0f4a3bc080487f8afc17 (diff)
downloadopenttd-d839526365e66b0846366807e2e697358819751c.tar.xz
Fix bf8d7df: Script/AI construction of rail track and waypoints (#6881)
Diffstat (limited to 'src')
-rw-r--r--src/script/api/script_rail.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp
index 25ad2ec13..f7682cfd8 100644
--- a/src/script/api/script_rail.cpp
+++ b/src/script/api/script_rail.cpp
@@ -204,7 +204,7 @@
EnforcePrecondition(false, GetRailTracks(tile) == RAILTRACK_NE_SW || GetRailTracks(tile) == RAILTRACK_NW_SE);
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
- return ScriptObject::DoCommand(tile, GetCurrentRailType() | (GetRailTracks(tile) == RAILTRACK_NE_SW ? AXIS_X : AXIS_Y) << 4 | 1 << 8 | 1 << 16, STAT_CLASS_WAYP | INVALID_STATION << 16, CMD_BUILD_RAIL_WAYPOINT);
+ return ScriptObject::DoCommand(tile, GetCurrentRailType() | (GetRailTracks(tile) == RAILTRACK_NE_SW ? AXIS_X : AXIS_Y) << 6 | 1 << 8 | 1 << 16, STAT_CLASS_WAYP | INVALID_STATION << 16, CMD_BUILD_RAIL_WAYPOINT);
}
/* static */ bool ScriptRail::RemoveRailWaypointTileRectangle(TileIndex tile, TileIndex tile2, bool keep_rail)
@@ -288,16 +288,16 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
int diag_offset = abs(abs((int)::TileX(*to) - (int)::TileX(tile)) - abs((int)::TileY(*to) - (int)::TileY(tile)));
uint32 p2 = 0;
if (::TileY(from) == ::TileY(*to)) {
- p2 |= (TRACK_X << 4);
+ p2 |= (TRACK_X << 6);
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
} else if (::TileX(from) == ::TileX(*to)) {
- p2 |= (TRACK_Y << 4);
+ p2 |= (TRACK_Y << 6);
*to -= ::MapSizeX() * Clamp((int)::TileY(*to) - (int)::TileY(tile), -1, 1);
} else if (::TileY(from) < ::TileY(tile)) {
if (::TileX(*to) < ::TileX(tile)) {
- p2 |= (TRACK_UPPER << 4);
+ p2 |= (TRACK_UPPER << 6);
} else {
- p2 |= (TRACK_LEFT << 4);
+ p2 |= (TRACK_LEFT << 6);
}
if (diag_offset != 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
@@ -306,9 +306,9 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
}
} else if (::TileY(from) > ::TileY(tile)) {
if (::TileX(*to) < ::TileX(tile)) {
- p2 |= (TRACK_RIGHT << 4);
+ p2 |= (TRACK_RIGHT << 6);
} else {
- p2 |= (TRACK_LOWER << 4);
+ p2 |= (TRACK_LOWER << 6);
}
if (diag_offset != 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
@@ -317,9 +317,9 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
}
} else if (::TileX(from) < ::TileX(tile)) {
if (::TileY(*to) < ::TileY(tile)) {
- p2 |= (TRACK_UPPER << 4);
+ p2 |= (TRACK_UPPER << 6);
} else {
- p2 |= (TRACK_RIGHT << 4);
+ p2 |= (TRACK_RIGHT << 6);
}
if (diag_offset == 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
@@ -328,9 +328,9 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
}
} else if (::TileX(from) > ::TileX(tile)) {
if (::TileY(*to) < ::TileY(tile)) {
- p2 |= (TRACK_LEFT << 4);
+ p2 |= (TRACK_LEFT << 6);
} else {
- p2 |= (TRACK_LOWER << 4);
+ p2 |= (TRACK_LOWER << 6);
}
if (diag_offset == 0) {
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);