Mercurial > hg > openttd
changeset 8377:33622fd09d68 draft
(svn r11944) -Fix: allow building drive-through road/tram stops at road/tram track that has no owner
author | smatz <smatz@openttd.org> |
---|---|
date | Tue, 22 Jan 2008 15:40:29 +0000 |
parents | 45740ebfa370 |
children | 7d35afa253ec |
files | src/station_cmd.cpp |
diffstat | 1 files changed, 14 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1357,13 +1357,23 @@ 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; }