summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-08-05 14:33:30 +0000
committersmatz <smatz@openttd.org>2009-08-05 14:33:30 +0000
commit47b111449bd613148fd0c3169178da987f8a1fd6 (patch)
tree1e42d1c03b563ed82ef490ba231e3d57d57f4fac
parente0ba8e6b560b0f2334df8c1ec7ca70260999fbe9 (diff)
downloadopenttd-47b111449bd613148fd0c3169178da987f8a1fd6.tar.xz
(svn r17071) -Fix: give a better error message when trying to make road one-way when it doesn't belong to you
-rw-r--r--src/road_cmd.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp
index 03c07bb40..f428898b0 100644
--- a/src/road_cmd.cpp
+++ b/src/road_cmd.cpp
@@ -489,9 +489,12 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
}
if ((existing & pieces) == pieces) {
/* We only want to set the (dis)allowed road directions */
- if (toggle_drd != DRD_NONE && rt != ROADTYPE_TRAM && IsRoadOwner(tile, ROADTYPE_ROAD, _current_company)) {
+ if (toggle_drd != DRD_NONE && rt != ROADTYPE_TRAM) {
if (crossing) return_cmd_error(STR_ERROR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION);
+ Owner owner = GetRoadOwner(tile, ROADTYPE_ROAD);
+ if (owner != OWNER_NONE && !CheckOwnership(owner)) return CMD_ERROR;
+
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
/* Ignore half built tiles */