summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2010-03-16 17:54:10 +0000
committerfrosch <frosch@openttd.org>2010-03-16 17:54:10 +0000
commit7bf13ea692f34c3c4d1afd4fcadce9d542b03f96 (patch)
tree3027011a8b04eca7a12a70664ecfc9b817fb06a7 /src
parent05d29d8a3d46b202cef21a192f8ae974ff23f99e (diff)
downloadopenttd-7bf13ea692f34c3c4d1afd4fcadce9d542b03f96.tar.xz
(svn r19436) -Fix: With certain game settings one could clear tiles for free when building long roads.
Diffstat (limited to 'src')
-rw-r--r--src/road_cmd.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index f70808d67..9942ae787 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -608,7 +608,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
default: {
do_clear:;
- CommandCost ret = DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+ CommandCost ret = DoCommand(tile, 0, 0, flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
if (ret.Failed()) return ret;
cost.AddCost(ret);
tile_cleared = true;
@@ -661,6 +661,10 @@ do_clear:;
}
if (flags & DC_EXEC) {
+ /* CmdBuildLongRoad calls us directly with DC_EXEC, so we may only clear the tile after all
+ * fail/success tests have been done. */
+ if (tile_cleared) DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
+
switch (GetTileType(tile)) {
case MP_ROAD: {
RoadTileType rtt = GetRoadTileType(tile);