summaryrefslogtreecommitdiff
path: root/src/ai/api
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2010-02-02 21:25:01 +0000
committerterkhen <terkhen@openttd.org>2010-02-02 21:25:01 +0000
commitb02a522038446757ba7de6fc81f9c9a6d03e3545 (patch)
treeccd5607f444773f8128e0e0b9ba8735eb37f1563 /src/ai/api
parent8d4773be942e17bef4788df0100552ee506fcfd6 (diff)
downloadopenttd-b02a522038446757ba7de6fc81f9c9a6d03e3545.tar.xz
(svn r18986) -Fix (r18803): Make building long roads fail for AIs if there is an obstacle in the way.
Diffstat (limited to 'src/ai/api')
-rw-r--r--src/ai/api/ai_road.cpp2
-rw-r--r--src/ai/api/ai_road.hpp4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/ai/api/ai_road.cpp b/src/ai/api/ai_road.cpp
index 27694ac10..24789bcf1 100644
--- a/src/ai/api/ai_road.cpp
+++ b/src/ai/api/ai_road.cpp
@@ -471,7 +471,7 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, !one_way || AIObject::GetRoadType() == ::ROADTYPE_ROAD);
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
- return AIObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (((start < end) == !full) ? 1 : 2) | (AIObject::GetRoadType() << 3) | ((one_way ? 1 : 0) << 5), CMD_BUILD_LONG_ROAD);
+ return AIObject::DoCommand(start, end, (::TileY(start) != ::TileY(end) ? 4 : 0) | (((start < end) == !full) ? 1 : 2) | (AIObject::GetRoadType() << 3) | ((one_way ? 1 : 0) << 5) | 1 << 6, CMD_BUILD_LONG_ROAD);
}
/* static */ bool AIRoad::BuildRoad(TileIndex start, TileIndex end)
diff --git a/src/ai/api/ai_road.hpp b/src/ai/api/ai_road.hpp
index a0bc131e6..0e71095e6 100644
--- a/src/ai/api/ai_road.hpp
+++ b/src/ai/api/ai_road.hpp
@@ -263,6 +263,7 @@ public:
* @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
+ * @note Construction will fail if an obstacle is found between the start and end tiles.
* @return Whether the road has been/can be build or not.
*/
static bool BuildRoad(TileIndex start, TileIndex end);
@@ -289,6 +290,7 @@ public:
* @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
+ * @note Construction will fail if an obstacle is found between the start and end tiles.
* @return Whether the road has been/can be build or not.
*/
static bool BuildOneWayRoad(TileIndex start, TileIndex end);
@@ -311,6 +313,7 @@ public:
* @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
+ * @note Construction will fail if an obstacle is found between the start and end tiles.
* @return Whether the road has been/can be build or not.
*/
static bool BuildRoadFull(TileIndex start, TileIndex end);
@@ -338,6 +341,7 @@ public:
* @exception AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
+ * @note Construction will fail if an obstacle is found between the start and end tiles.
* @return Whether the road has been/can be build or not.
*/
static bool BuildOneWayRoadFull(TileIndex start, TileIndex end);