(svn r10030) -Fix [FS#823]: one could build on (some) slopes when building on slopes was disabled.
authorrubidium
Sun, 03 Jun 2007 19:22:23 +0000
changeset 6791 26232b05aa88
parent 6790 f22a85d6e1a4
child 6792 f21e05f5ea37
(svn r10030) -Fix [FS#823]: one could build on (some) slopes when building on slopes was disabled.
src/rail_cmd.cpp
--- a/src/rail_cmd.cpp	Sat Jun 02 21:07:03 2007 +0000
+++ b/src/rail_cmd.cpp	Sun Jun 03 19:22:23 2007 +0000
@@ -206,20 +206,17 @@
 		}
 
 		/* no special foundation */
-		if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0)
+		if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0) {
 			return 0;
+		} else if (!_patches.build_on_slopes || _is_old_ai_player) {
+			return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
+		}
 
 		if ((~_valid_tileh_slopes[1][tileh] & rail_bits) == 0 || ( // whole tile is leveled up
 					(rail_bits == TRACK_BIT_X || rail_bits == TRACK_BIT_Y) &&
 					(tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)
 				)) { // partly up
-			if (existing != 0) {
-				return 0;
-			} else if (!_patches.build_on_slopes || _is_old_ai_player) {
-				return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
-			} else {
-				return _price.terraform;
-			}
+			return (existing != 0) ? 0 : _price.terraform;
 		}
 	}
 	return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);