src/industry_cmd.cpp
changeset 7480 1ae973d5f341
parent 7473 3dfe8243a870
child 7494 ab05bad37410
equal deleted inserted replaced
7479:2bc7aacf47eb 7480:1ae973d5f341
  1337 			/* This tile needs terraforming. Check if we can do that without
  1337 			/* This tile needs terraforming. Check if we can do that without
  1338 			 *  damaging the surroundings too much. */
  1338 			 *  damaging the surroundings too much. */
  1339 			if (!CheckCanTerraformSurroundingTiles(tile_walk, h, 0)) return false;
  1339 			if (!CheckCanTerraformSurroundingTiles(tile_walk, h, 0)) return false;
  1340 			/* This is not 100% correct check, but the best we can do without modifying the map.
  1340 			/* This is not 100% correct check, but the best we can do without modifying the map.
  1341 			 *  What is missing, is if the difference in height is more than 1.. */
  1341 			 *  What is missing, is if the difference in height is more than 1.. */
  1342 			if (CmdFailed(DoCommand(tile_walk, 8, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND))) return false;
  1342 			if (CmdFailed(DoCommand(tile_walk, SLOPE_N, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND))) return false;
  1343 		}
  1343 		}
  1344 	} END_TILE_LOOP(tile_walk, size_x, size_y, cur_tile)
  1344 	} END_TILE_LOOP(tile_walk, size_x, size_y, cur_tile)
  1345 
  1345 
  1346 	if (flags & DC_EXEC) {
  1346 	if (flags & DC_EXEC) {
  1347 		/* Terraform the land under the industry */
  1347 		/* Terraform the land under the industry */
  1349 			curh = TileHeight(tile_walk);
  1349 			curh = TileHeight(tile_walk);
  1350 			while (curh != h) {
  1350 			while (curh != h) {
  1351 				/* We give the terraforming for free here, because we can't calculate
  1351 				/* We give the terraforming for free here, because we can't calculate
  1352 				 *  exact cost in the test-round, and as we all know, that will cause
  1352 				 *  exact cost in the test-round, and as we all know, that will cause
  1353 				 *  a nice assert if they don't match ;) */
  1353 				 *  a nice assert if they don't match ;) */
  1354 				DoCommand(tile_walk, 8, (curh > h) ? 0 : 1, flags, CMD_TERRAFORM_LAND);
  1354 				DoCommand(tile_walk, SLOPE_N, (curh > h) ? 0 : 1, flags, CMD_TERRAFORM_LAND);
  1355 				curh += (curh > h) ? -1 : 1;
  1355 				curh += (curh > h) ? -1 : 1;
  1356 			}
  1356 			}
  1357 		} END_TILE_LOOP(tile_walk, size_x, size_y, cur_tile)
  1357 		} END_TILE_LOOP(tile_walk, size_x, size_y, cur_tile)
  1358 	}
  1358 	}
  1359 
  1359