summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-01-22 15:40:29 +0000
committersmatz <smatz@openttd.org>2008-01-22 15:40:29 +0000
commit96a18d859f8889fa9b1843d68bd0b61b4a9a5420 (patch)
treef8459a8ffd6a39aaf2fe09feb71a1e0d356e8115 /src
parent59ec5e62ce645e09657764344108cae3b7b03632 (diff)
downloadopenttd-96a18d859f8889fa9b1843d68bd0b61b4a9a5420.tar.xz
(svn r11944) -Fix: allow building drive-through road/tram stops at road/tram track that has no owner
Diffstat (limited to 'src')
-rw-r--r--src/station_cmd.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 38a0681c6..316403043 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1357,13 +1357,23 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
if (GetRoadTileType(tile) != ROAD_TILE_NORMAL) return CMD_ERROR;
+ RoadTypes cur_rts = GetRoadTypes(tile);
+
+ /* there is a road, check if we can build road+tram stop over it */
+ if (HasBit(cur_rts, ROADTYPE_ROAD)) {
+ Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
+ if (road_owner != OWNER_TOWN && road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR;
+ }
+
+ /* there is a tram, check if we can build road+tram stop over it */
+ if (HasBit(cur_rts, ROADTYPE_TRAM)) {
+ Owner tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
+ if (tram_owner != OWNER_NONE && !CheckOwnership(tram_owner)) return CMD_ERROR;
+ }
+
/* Don't allow building the roadstop when vehicles are already driving on it */
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
- RoadTypes cur_rts = GetRoadTypes(tile);
- if (GetRoadOwner(tile, ROADTYPE_ROAD) != OWNER_TOWN && HasBit(cur_rts, ROADTYPE_ROAD) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_ROAD))) return CMD_ERROR;
- if (HasBit(cur_rts, ROADTYPE_TRAM) && !CheckOwnership(GetRoadOwner(tile, ROADTYPE_TRAM))) return CMD_ERROR;
-
/* Do not remove roadtypes! */
rts |= cur_rts;
}