summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-31 13:06:28 +0000
committerrubidium <rubidium@openttd.org>2007-08-31 13:06:28 +0000
commitb3f9121f14e3ea39dd84b8a17d5e22662cb0b885 (patch)
tree4ba3c5634643f493d5a097726c4c5bc6bfadd9f7
parent3b672a5c5ff22ec95419fae6ce33dbe5ce423f96 (diff)
downloadopenttd-b3f9121f14e3ea39dd84b8a17d5e22662cb0b885.tar.xz
(svn r11015) -Fix [FS#1166]: towns would build bridges through eachother.
-rw-r--r--src/town_cmd.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 852e4e351..5759189d2 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -1084,19 +1084,17 @@ build_road_and_exit:
/* Quit if it selecting an appropiate bridge type fails a large number of times. */
j = 22;
- {
- int32 bridge_len = GetBridgeLength(tile, tmptile);
- do {
- byte bridge_type = RandomRange(MAX_BRIDGES - 1);
- if (CheckBridge_Stuff(bridge_type, bridge_len)) {
- if (CmdSucceeded(DoCommand(tile, tmptile, bridge_type | ((0x80 | ROADTYPES_ROAD) << 8), DC_EXEC | DC_AUTO, CMD_BUILD_BRIDGE)))
- _grow_town_result = -1;
+ do {
+ byte bridge_type = RandomRange(MAX_BRIDGES - 1);
+ /* Can we actually build the bridge? */
+ if (CmdSucceeded(DoCommand(tile, tmptile, bridge_type | ((0x80 | ROADTYPES_ROAD) << 8), DC_AUTO, CMD_BUILD_BRIDGE))) {
+ DoCommand(tile, tmptile, bridge_type | ((0x80 | ROADTYPES_ROAD) << 8), DC_EXEC | DC_AUTO, CMD_BUILD_BRIDGE);
+ _grow_town_result = -1;
- /* obviously, if building any bridge would fail, there is no need to try other bridge-types */
- return;
- }
- } while (--j != 0);
- }
+ /* obviously, if building any bridge would fail, there is no need to try other bridge-types */
+ return;
+ }
+ } while (--j != 0);
}
/** Returns "growth" if a house was built, or no if the build failed.