|
@@ -286,13 +286,13 @@ CommandCost CmdTerraformLand(TileIndex t
|
|
|
if (pass == 0) {
|
|
|
tile_flags &= ~DC_EXEC;
|
|
|
tile_flags |= DC_NO_MODIFY_TOWN_RATING;
|
|
|
}
|
|
|
CommandCost cost;
|
|
|
if (indirectly_cleared) {
|
|
|
cost = DoCommand(t, 0, 0, tile_flags, CMD_LANDSCAPE_CLEAR);
|
|
|
cost = DoCommand(tile_flags, CMD_LANDSCAPE_CLEAR, t, 0, 0);
|
|
|
} else {
|
|
|
cost = _tile_type_procs[GetTileType(t)]->terraform_tile_proc(t, tile_flags, z_min, tileh);
|
|
|
}
|
|
|
old_generating_world.Restore();
|
|
|
if (cost.Failed()) {
|
|
|
_terraform_err_tile = t;
|
|
@@ -375,13 +375,13 @@ CommandCost CmdLevelLand(TileIndex tile,
|
|
|
|
|
|
TileIterator *iter = HasBit(p2, 0) ? (TileIterator *)new DiagonalTileIterator(tile, p1) : new OrthogonalTileIterator(tile, p1);
|
|
|
for (; *iter != INVALID_TILE; ++(*iter)) {
|
|
|
TileIndex t = *iter;
|
|
|
uint curh = TileHeight(t);
|
|
|
while (curh != h) {
|
|
|
CommandCost ret = DoCommand(t, SLOPE_N, (curh > h) ? 0 : 1, flags & ~DC_EXEC, CMD_TERRAFORM_LAND);
|
|
|
CommandCost ret = DoCommand(flags & ~DC_EXEC, CMD_TERRAFORM_LAND, t, SLOPE_N, (curh > h) ? 0 : 1);
|
|
|
if (ret.Failed()) {
|
|
|
last_error = ret;
|
|
|
|
|
|
/* Did we reach the limit? */
|
|
|
if (ret.GetErrorMessage() == STR_ERROR_TERRAFORM_LIMIT_REACHED) limit = 0;
|
|
|
break;
|
|
@@ -391,13 +391,13 @@ CommandCost CmdLevelLand(TileIndex tile,
|
|
|
money -= ret.GetCost();
|
|
|
if (money < 0) {
|
|
|
_additional_cash_required = ret.GetCost();
|
|
|
delete iter;
|
|
|
return cost;
|
|
|
}
|
|
|
DoCommand(t, SLOPE_N, (curh > h) ? 0 : 1, flags, CMD_TERRAFORM_LAND);
|
|
|
DoCommand(flags, CMD_TERRAFORM_LAND, t, SLOPE_N, (curh > h) ? 0 : 1);
|
|
|
} else {
|
|
|
/* When we're at the terraform limit we better bail (unneeded) testing as well.
|
|
|
* This will probably cause the terraforming cost to be underestimated, but only
|
|
|
* when it's near the terraforming limit. Even then, the estimation is
|
|
|
* completely off due to it basically counting terraforming double, so it being
|
|
|
* cut off earlier might even give a better estimate in some cases. */
|