(svn r4585) - Fix [FS#130] - Obscure road dragging bug. The road build command did not return the appropiate error message of invalid-slope when building road.
authorDarkvater
Wed, 26 Apr 2006 21:44:22 +0000
changeset 3670 05913fabaebb
parent 3669 8a3a5d008971
child 3671 6d3a34989d05
(svn r4585) - Fix [FS#130] - Obscure road dragging bug. The road build command did not return the appropiate error message of invalid-slope when building road.
road_cmd.c
--- a/road_cmd.c	Wed Apr 26 21:10:01 2006 +0000
+++ b/road_cmd.c	Wed Apr 26 21:44:22 2006 +0000
@@ -386,10 +386,11 @@
 	}
 
 	ret = CheckRoadSlope(tileh, &pieces, existing);
-	if (CmdFailed(ret)) return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
-	if (ret != 0 && (!_patches.build_on_slopes || _is_old_ai_player)) {
-		return CMD_ERROR;
-	}
+	/* Return an error if we need to build a foundation (ret != 0) but the
+	 * current patch-setting is turned off (or stupid AI@work) */
+	if (CmdFailed(ret) || ret != 0 && (!_patches.build_on_slopes || _is_old_ai_player))
+		return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
+
 	cost += ret;
 
 	if (IsTileType(tile, MP_STREET)) {