summaryrefslogtreecommitdiff
path: root/src/object_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-01-06 19:49:44 +0000
committerrubidium <rubidium@openttd.org>2012-01-06 19:49:44 +0000
commit9d958ff581a4ca06912228812a89d087aa0dceb8 (patch)
treea03cdcadf9f7af1e52fa9d6b70364661a6b677ae /src/object_cmd.cpp
parentc19d7bfdae258e3759f3d6ec079911bc65393ba6 (diff)
downloadopenttd-9d958ff581a4ca06912228812a89d087aa0dceb8.tar.xz
(svn r23763) -Fix [FS#4956]: check whether a water tile is really empty when overbuilding it with an object
Diffstat (limited to 'src/object_cmd.cpp')
-rw-r--r--src/object_cmd.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index 103e7b6c0..9f1a8377f 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -33,6 +33,7 @@
#include "newgrf_object.h"
#include "date_func.h"
#include "newgrf_debug.h"
+#include "vehicle_func.h"
#include "table/strings.h"
#include "table/object_land.h"
@@ -227,6 +228,9 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
/* Can't build on water owned by another company. */
Owner o = GetTileOwner(t);
if (o != OWNER_NONE && o != OWNER_WATER) cost.AddCost(CheckOwnership(o, t));
+
+ /* However, the tile has to be clear of vehicles. */
+ cost.AddCost(EnsureNoVehicleOnGround(t));
}
} else {
if (!allow_ground) return_cmd_error(STR_ERROR_MUST_BE_BUILT_ON_WATER);