summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorYexo <Yexo@openttd.org>2009-01-22 00:23:37 +0000
committerYexo <Yexo@openttd.org>2009-01-22 00:23:37 +0000
commit500356f784933bb0771ce1e8d57d122b87259ebf (patch)
treec341d6bd7524169461427705900a7a4cc34f632c /src
parenta2a5cad3035552d58452b2688c0f34efb2cd1790 (diff)
downloadopenttd-500356f784933bb0771ce1e8d57d122b87259ebf.tar.xz
(svn r15203) -Fix (r15190): CmdTerraformLand didn't check it's parameters good enough.
Diffstat (limited to 'src')
-rw-r--r--src/terraform_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp
index 337eca2fd..bdcc49fab 100644
--- a/src/terraform_cmd.cpp
+++ b/src/terraform_cmd.cpp
@@ -240,21 +240,21 @@ CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
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;