src/rail_cmd.cpp
changeset 6791 26232b05aa88
parent 6770 408585d467f9
child 6943 1914f26aee04
equal deleted inserted replaced
6790:f22a85d6e1a4 6791:26232b05aa88
   204 				~_valid_tileh_slopes[1][tileh] & rail_bits) {
   204 				~_valid_tileh_slopes[1][tileh] & rail_bits) {
   205 			return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER);
   205 			return_cmd_error(STR_3807_CAN_T_BUILD_ON_WATER);
   206 		}
   206 		}
   207 
   207 
   208 		/* no special foundation */
   208 		/* no special foundation */
   209 		if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0)
   209 		if ((~_valid_tileh_slopes[0][tileh] & rail_bits) == 0) {
   210 			return 0;
   210 			return 0;
       
   211 		} else if (!_patches.build_on_slopes || _is_old_ai_player) {
       
   212 			return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
       
   213 		}
   211 
   214 
   212 		if ((~_valid_tileh_slopes[1][tileh] & rail_bits) == 0 || ( // whole tile is leveled up
   215 		if ((~_valid_tileh_slopes[1][tileh] & rail_bits) == 0 || ( // whole tile is leveled up
   213 					(rail_bits == TRACK_BIT_X || rail_bits == TRACK_BIT_Y) &&
   216 					(rail_bits == TRACK_BIT_X || rail_bits == TRACK_BIT_Y) &&
   214 					(tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)
   217 					(tileh == SLOPE_W || tileh == SLOPE_S || tileh == SLOPE_E || tileh == SLOPE_N)
   215 				)) { // partly up
   218 				)) { // partly up
   216 			if (existing != 0) {
   219 			return (existing != 0) ? 0 : _price.terraform;
   217 				return 0;
       
   218 			} else if (!_patches.build_on_slopes || _is_old_ai_player) {
       
   219 				return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
       
   220 			} else {
       
   221 				return _price.terraform;
       
   222 			}
       
   223 		}
   220 		}
   224 	}
   221 	}
   225 	return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
   222 	return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
   226 }
   223 }
   227 
   224