src/industry_cmd.cpp
changeset 8049 4182740f3d82
parent 8030 135a60c84e95
child 8054 ccf0f72dfe10
equal deleted inserted replaced
8048:ee1bbcc3801a 8049:4182740f3d82
  1234 			} else {
  1234 			} else {
  1235 				Slope tileh = GetTileSlope(cur_tile, NULL);
  1235 				Slope tileh = GetTileSlope(cur_tile, NULL);
  1236 				refused_slope |= IsSlopeRefused(tileh, its->slopes_refused);
  1236 				refused_slope |= IsSlopeRefused(tileh, its->slopes_refused);
  1237 			}
  1237 			}
  1238 
  1238 
  1239 			if (ind_behav & (INDUSTRYBEH_ONLY_INTOWN | INDUSTRYBEH_TOWN1200_MORE)) {
  1239 			if (ind_behav & (INDUSTRYBEH_ONLY_INTOWN)) {
  1240 				if (!IsTileType(cur_tile, MP_HOUSE)) {
  1240 				if (!IsTileType(cur_tile, MP_HOUSE)) {
  1241 					_error_message = STR_029D_CAN_ONLY_BE_BUILT_IN_TOWNS;
  1241 					_error_message = STR_030D_CAN_ONLY_BE_BUILT_IN_TOWNS;
  1242 					return false;
  1242 					return false;
  1243 				}
  1243 				}
  1244 				if (CmdFailed(DoCommand(cur_tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR))) return false;
  1244 				if (CmdFailed(DoCommand(cur_tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR))) return false;
  1245 			} else if ((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) == 0 || !IsTileType(cur_tile, MP_HOUSE)) {
  1245 			} else if ((ind_behav & INDUSTRYBEH_ONLY_NEARTOWN) == 0 || !IsTileType(cur_tile, MP_HOUSE)) {
  1246 				if (CmdFailed(DoCommand(cur_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR))) return false;
  1246 				if (CmdFailed(DoCommand(cur_tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR))) return false;
  1251 	if (custom_shape_check != NULL) *custom_shape_check = custom_shape;
  1251 	if (custom_shape_check != NULL) *custom_shape_check = custom_shape;
  1252 
  1252 
  1253 	/* It is almost impossible to have a fully flat land in TG, so what we
  1253 	/* It is almost impossible to have a fully flat land in TG, so what we
  1254 	 *  do is that we check if we can make the land flat later on. See
  1254 	 *  do is that we check if we can make the land flat later on. See
  1255 	 *  CheckIfCanLevelIndustryPlatform(). */
  1255 	 *  CheckIfCanLevelIndustryPlatform(). */
  1256 	return !refused_slope || (_patches.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape);
  1256 	return !refused_slope || (_patches.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions);
  1257 }
  1257 }
  1258 
  1258 
  1259 static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)
  1259 static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)
  1260 {
  1260 {
  1261 	if ((GetIndustrySpec(type)->behaviour & INDUSTRYBEH_TOWN1200_MORE) && t->population < 1200) {
  1261 	if ((GetIndustrySpec(type)->behaviour & INDUSTRYBEH_TOWN1200_MORE) && t->population < 1200) {
  1556 		if (!CheckIfCallBackAllowsCreation(tile, type, itspec_index)) return NULL;
  1556 		if (!CheckIfCallBackAllowsCreation(tile, type, itspec_index)) return NULL;
  1557 	} else {
  1557 	} else {
  1558 		if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
  1558 		if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
  1559 	}
  1559 	}
  1560 
  1560 
  1561 	if (!custom_shape_check && _patches.land_generator == LG_TERRAGENESIS && _generating_world && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
  1561 	if (!custom_shape_check && _patches.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
  1562 	if (!CheckIfTooCloseToIndustry(tile, type)) return NULL;
  1562 	if (!CheckIfTooCloseToIndustry(tile, type)) return NULL;
  1563 
  1563 
  1564 	const Town *t = CheckMultipleIndustryInTown(tile, type);
  1564 	const Town *t = CheckMultipleIndustryInTown(tile, type);
  1565 	if (t == NULL) return NULL;
  1565 	if (t == NULL) return NULL;
  1566 
  1566