diff options
-rw-r--r-- | src/road_cmd.cpp | 9 | ||||
-rw-r--r-- | src/station_cmd.cpp | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index dcf9b23d0..449a8016b 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -563,6 +563,15 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 } return_cmd_error(STR_ERROR_ALREADY_BUILT); } + /* Disallow breaking end-of-line of someone else + * so trams can still reverse on this tile. */ + if (rt == ROADTYPE_TRAM && HasExactlyOneBit(existing)) { + Owner owner = GetRoadOwner(tile, rt); + if (Company::IsValidID(owner)) { + CommandCost ret = CheckOwnership(owner); + if (ret.Failed()) return ret; + } + } break; } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 1a641113a..f5ecd727c 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -963,7 +963,11 @@ static CommandCost CheckFlatLandRoadStop(TileArea tile_area, DoCommandFlag flags /* There is a tram, check if we can build road+tram stop over it. */ if (HasBit(cur_rts, ROADTYPE_TRAM)) { Owner tram_owner = GetRoadOwner(cur_tile, ROADTYPE_TRAM); - if (!_settings_game.construction.road_stop_on_competitor_road && tram_owner != OWNER_NONE) { + if (Company::IsValidID(tram_owner) && + (!_settings_game.construction.road_stop_on_competitor_road || + /* Disallow breaking end-of-line of someone else + * so trams can still reverse on this tile. */ + HasExactlyOneBit(GetRoadBits(cur_tile, ROADTYPE_TRAM)))) { CommandCost ret = CheckOwnership(tram_owner); if (ret.Failed()) return ret; } |