summaryrefslogtreecommitdiff
path: root/src/object_cmd.cpp
diff options
context:
space:
mode:
authormichi_cc <michi_cc@openttd.org>2011-07-08 14:42:18 +0000
committermichi_cc <michi_cc@openttd.org>2011-07-08 14:42:18 +0000
commit8565703a4c86c776665df6dae5bb6bdab949ce58 (patch)
tree0653c6f5d08ec926d6d907b250923e44ed29aef4 /src/object_cmd.cpp
parenta6ce6c144b77e24a4555e5ecb6f6fcbddd1c70d5 (diff)
downloadopenttd-8565703a4c86c776665df6dae5bb6bdab949ce58.tar.xz
(svn r22643) -Fix: Disallow building NewObjects on water tiles owned by another company.
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 4425d1118..9fc5b8ee0 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -214,6 +214,10 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
/* Normal water tiles don't have to be cleared. For all other tile types clear
* the tile but leave the water. */
cost.AddCost(DoCommand(t, 0, 0, flags & ~DC_NO_WATER, CMD_LANDSCAPE_CLEAR));
+ } else {
+ /* 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));
}
} else {
if (!allow_ground) return_cmd_error(STR_ERROR_MUST_BE_BUILT_ON_WATER);