summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-02-02 22:27:03 +0000
committerterkhen <terkhen@openttd.org>2010-02-02 22:27:03 +0000
commit2798fdf082a5372d3e6a60556af24871618287c7 (patch)
treee1c6121f57b445719a26175e64c5b4f1a507bc22 /src/ai
parentb02a522038446757ba7de6fc81f9c9a6d03e3545 (diff)
downloadopenttd-2798fdf082a5372d3e6a60556af24871618287c7.tar.xz
(svn r18987) -Fix: [NoAI] Make building long rails fail for AIs if there is an obstacle in the way.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/api/ai_rail.cpp2
-rw-r--r--src/ai/api/ai_rail.hpp1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/ai/api/ai_rail.cpp b/src/ai/api/ai_rail.cpp
index 9b2974a30..ae349ccde 100644
--- a/src/ai/api/ai_rail.cpp
+++ b/src/ai/api/ai_rail.cpp
@@ -332,7 +332,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);
+ uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 8;
return AIObject::DoCommand(tile, to, p2, CMD_BUILD_RAILROAD_TRACK);
}
diff --git a/src/ai/api/ai_rail.hpp b/src/ai/api/ai_rail.hpp
index 7170412ba..e82d01ae9 100644
--- a/src/ai/api/ai_rail.hpp
+++ b/src/ai/api/ai_rail.hpp
@@ -380,6 +380,7 @@ public:
* @exception AIRail::ERR_CROSSING_ON_ONEWAY_ROAD
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
* @exception AIError::ERR_ALREADY_BUILT
+ * @note Construction will fail if an obstacle is found between the start and end tiles.
* @return Whether the rail has been/can be build or not.
*/
static bool BuildRail(TileIndex from, TileIndex tile, TileIndex to);