1
0
Fork 0

(svn r15203) -Fix (r15190): CmdTerraformLand didn't check it's parameters good enough.

release/0.7
Yexo 2009-01-22 00:23:37 +00:00
parent a89e63f672
commit cb7449b83c
1 changed files with 3 additions and 3 deletions

View File

@ -240,21 +240,21 @@ CommandCost CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2,
ts.modheight_count = ts.tile_table_count = 0; ts.modheight_count = ts.tile_table_count = 0;
/* Compute the costs and the terraforming result in a model of the landscape */ /* 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); TileIndex t = tile + TileDiffXY(1, 0);
CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction); CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction);
if (CmdFailed(cost)) return cost; if (CmdFailed(cost)) return cost;
total_cost.AddCost(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); TileIndex t = tile + TileDiffXY(1, 1);
CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction); CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction);
if (CmdFailed(cost)) return cost; if (CmdFailed(cost)) return cost;
total_cost.AddCost(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); TileIndex t = tile + TileDiffXY(0, 1);
CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction); CommandCost cost = TerraformTileHeight(&ts, t, TileHeight(t) + direction);
if (CmdFailed(cost)) return cost; if (CmdFailed(cost)) return cost;