# HG changeset patch # User Yexo # Date 1232583817 0 # Node ID 54ff22c7986f0923858b65c39ecc8f801411e435 # Parent eede61d2681e8563deaf2db589e8147134e960b9 (svn r15203) -Fix (r15190): CmdTerraformLand didn't check it's parameters good enough. diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp --- a/src/terraform_cmd.cpp +++ b/src/terraform_cmd.cpp @@ -240,21 +240,21 @@ ts.modheight_count = ts.tile_table_count = 0; /* Compute the costs and the terraforming result in a model of the landscape */ - if ((p1 & SLOPE_W) != 0) { + if ((p1 & SLOPE_W) != 0 && tile + TileDiffXY(1, 0) < MapSize()) { TileIndex t = tile + TileDiffXY(1, 0); CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction); if (CmdFailed(cost)) return cost; total_cost.AddCost(cost); } - if ((p1 & SLOPE_S) != 0) { + if ((p1 & SLOPE_S) != 0 && tile + TileDiffXY(1, 1) < MapSize()) { TileIndex t = tile + TileDiffXY(1, 1); CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction); if (CmdFailed(cost)) return cost; total_cost.AddCost(cost); } - if ((p1 & SLOPE_E) != 0) { + if ((p1 & SLOPE_E) != 0 && tile + TileDiffXY(0, 1) < MapSize()) { TileIndex t = tile + TileDiffXY(0, 1); CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction); if (CmdFailed(cost)) return cost;