diff options
author | terkhen <terkhen@openttd.org> | 2010-02-02 21:25:01 +0000 |
---|---|---|
committer | terkhen <terkhen@openttd.org> | 2010-02-02 21:25:01 +0000 |
commit | b02a522038446757ba7de6fc81f9c9a6d03e3545 (patch) | |
tree | ccd5607f444773f8128e0e0b9ba8735eb37f1563 /src/road_cmd.cpp | |
parent | 8d4773be942e17bef4788df0100552ee506fcfd6 (diff) | |
download | openttd-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/road_cmd.cpp')
-rw-r--r-- | src/road_cmd.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 477c35059..aa5c14943 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -690,6 +690,7 @@ do_clear:; * - p2 = (bit 2) - direction: 0 = along x-axis, 1 = along y-axis (p2 & 4) * - p2 = (bit 3 + 4) - road type * - p2 = (bit 5) - set road direction + * - p2 = (bit 6) - 0 = build up to an obstacle, 1 = fail if an obstacle is found (used for AIs). * @param text unused * @return the cost of this operation or an error */ @@ -742,7 +743,10 @@ CommandCost CmdBuildLongRoad(TileIndex start_tile, DoCommandFlag flags, uint32 p _error_message = INVALID_STRING_ID; CommandCost ret = DoCommand(tile, drd << 6 | rt << 4 | bits, 0, flags, CMD_BUILD_ROAD); if (ret.Failed()) { - if (_error_message != STR_ERROR_ALREADY_BUILT) break; + if (_error_message != STR_ERROR_ALREADY_BUILT) { + if (HasBit(p2, 6)) return CMD_ERROR; + break; + } } else { had_success = true; /* Only pay for the upgrade on one side of the bridges and tunnels */ |