Mercurial > hg > openttd
changeset 10868:54ff22c7986f draft
(svn r15203) -Fix (r15190): CmdTerraformLand didn't check it's parameters good enough.
author | Yexo <Yexo@openttd.org> |
---|---|
date | Thu, 22 Jan 2009 00:23:37 +0000 |
parents | eede61d2681e |
children | d223c363de9d |
files | src/terraform_cmd.cpp |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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;