summaryrefslogtreecommitdiff
path: root/src/script
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-01-26 14:54:34 +0000
committerfrosch <frosch@openttd.org>2014-01-26 14:54:34 +0000
commit5d4c4b9172632fa069592298e2f86a3259ff760c (patch)
tree62244f3234c85d4104cbfac8cc5f2ec84313f369 /src/script
parentcce3d4fec805ae3c55d24a9d05cbc6c1a3aeba99 (diff)
downloadopenttd-5d4c4b9172632fa069592298e2f86a3259ff760c.tar.xz
(svn r26279) -Fix [FS#5853]: [NoAI] Some RemoveRail methods required to set a valid railtype, though it was not used anyway. Remove the need to set one.
Diffstat (limited to 'src/script')
-rw-r--r--src/script/api/script_rail.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/script/api/script_rail.cpp b/src/script/api/script_rail.cpp
index 161007de9..26317a72c 100644
--- a/src/script/api/script_rail.cpp
+++ b/src/script/api/script_rail.cpp
@@ -253,7 +253,7 @@
EnforcePrecondition(false, GetRailTracks(tile) & rail_track);
EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
- return ScriptObject::DoCommand(tile, tile, GetCurrentRailType() | (FindFirstTrack((::TrackBits)rail_track) << 4), CMD_REMOVE_RAILROAD_TRACK);
+ return ScriptObject::DoCommand(tile, tile, FindFirstTrack((::TrackBits)rail_track) << 4, CMD_REMOVE_RAILROAD_TRACK);
}
/* static */ bool ScriptRail::AreTilesConnected(TileIndex from, TileIndex tile, TileIndex to)
@@ -284,7 +284,7 @@
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 = ScriptRail::GetCurrentRailType();
+ uint32 p2 = 0;
if (::TileY(from) == ::TileY(*to)) {
p2 |= (TRACK_X << 4);
*to -= Clamp((int)::TileX(*to) - (int)::TileX(tile), -1, 1);
@@ -353,7 +353,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
- uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 8;
+ uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 8 | ScriptRail::GetCurrentRailType();;
return ScriptObject::DoCommand(tile, to, p2, CMD_BUILD_RAILROAD_TRACK);
}
@@ -370,7 +370,6 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
- if (!IsRailTypeAvailable(GetCurrentRailType())) SetCurrentRailType(GetRailType(tile));
uint32 p2 = SimulateDrag(from, tile, &to);
return ScriptObject::DoCommand(tile, to, p2, CMD_REMOVE_RAILROAD_TRACK);
}