(svn r11015) -Fix [FS#1166]: towns would build bridges through eachother.
authorrubidium
Fri, 31 Aug 2007 13:06:28 +0000
changeset 7500 e64b04e6f3b1
parent 7499 7b5d83a10725
child 7501 e4897cce1fac
(svn r11015) -Fix [FS#1166]: towns would build bridges through eachother.
src/town_cmd.cpp
--- a/src/town_cmd.cpp	Fri Aug 31 12:57:52 2007 +0000
+++ b/src/town_cmd.cpp	Fri Aug 31 13:06:28 2007 +0000
@@ -1084,19 +1084,17 @@
 
 	/* 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;
-
-				/* obviously, if building any bridge would fail, there is no need to try other bridge-types */
-				return;
-			}
-		} while (--j != 0);
-	}
+	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);
 }
 
 /** Returns "growth" if a house was built, or no if the build failed.