summaryrefslogtreecommitdiff
path: root/water_cmd.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-06-03 15:10:39 +0000
committerpeter1138 <peter1138@openttd.org>2006-06-03 15:10:39 +0000
commit59d5ed821f814b3693a05b7f8ea61f449db4c54a (patch)
treeffeb9c12c3b758ab755bc68829298c9099d230f0 /water_cmd.c
parentd7261da206b81bccc5d370e79cecd5a0f9983de0 (diff)
downloadopenttd-59d5ed821f814b3693a05b7f8ea61f449db4c54a.tar.xz
(svn r5084) - Add owner attribute to canals and locks. This makes them more useful in multiplayer games, as before, anyone could delete any canal or lock tile. This doesn't affect whose ships can use whose canals or locks.
Diffstat (limited to 'water_cmd.c')
-rw-r--r--water_cmd.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/water_cmd.c b/water_cmd.c
index a7e07e0a5..8953f9ec5 100644
--- a/water_cmd.c
+++ b/water_cmd.c
@@ -148,7 +148,7 @@ static int32 DoBuildShiplift(TileIndex tile, DiagDirection dir, uint32 flags)
}
if (flags & DC_EXEC) {
- MakeLock(tile, dir);
+ MakeLock(tile, _current_player, dir);
MarkTileDirtyByTile(tile);
MarkTileDirtyByTile(tile - delta);
MarkTileDirtyByTile(tile + delta);
@@ -161,6 +161,8 @@ static int32 RemoveShiplift(TileIndex tile, uint32 flags)
{
TileIndexDiff delta = TileOffsByDir(GetLockDirection(tile));
+ if (!CheckTileOwnership(tile)) return CMD_ERROR;
+
// make sure no vehicle is on the tile.
if (!EnsureNoVehicle(tile) || !EnsureNoVehicle(tile + delta) || !EnsureNoVehicle(tile - delta))
return CMD_ERROR;
@@ -249,7 +251,11 @@ int32 CmdBuildCanal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
cost += ret;
if (flags & DC_EXEC) {
- MakeWater(tile);
+ if (TileHeight(tile) == 0) {
+ MakeWater(tile);
+ } else {
+ MakeCanal(tile, _current_player);
+ }
MarkTileDirtyByTile(tile);
MarkTilesAroundDirty(tile);
}
@@ -279,6 +285,8 @@ static int32 ClearTile_Water(TileIndex tile, byte flags)
return_cmd_error(STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP);
}
+ if (GetTileOwner(tile) != OWNER_WATER && !CheckTileOwnership(tile)) return CMD_ERROR;
+
if (flags & DC_EXEC) DoClearSquare(tile);
return _price.clear_water;