diff options
author | frosch <frosch@openttd.org> | 2008-05-24 19:36:20 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2008-05-24 19:36:20 +0000 |
commit | 6e7a7412cdb824dd53ca8470dcfbba1d07f891b8 (patch) | |
tree | c397ff33001e474f450c64ea28b740db9fd01e81 /src/station_cmd.cpp | |
parent | c34b458ace0695fd89116dc29de4e1bec5fca89b (diff) | |
download | openttd-6e7a7412cdb824dd53ca8470dcfbba1d07f891b8.tar.xz |
(svn r13233) -Fix: Replace some (incorrect) evaluations of TileOwner by RoadOwner.
-Fix: Before evaluating RoadOwner, check if the roadtype is present.
-Fix: Some places assumed that MP_ROAD means normal street.
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r-- | src/station_cmd.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 0fe4bebf2..302d36c19 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -1300,7 +1300,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) bool type = HasBit(p2, 0); bool is_drive_through = HasBit(p2, 1); bool build_over_road = is_drive_through && IsNormalRoadTile(tile); - bool town_owned_road = build_over_road && IsTileOwner(tile, OWNER_TOWN); + bool town_owned_road = false; RoadTypes rts = (RoadTypes)GB(p2, 2, 3); if (!AreValidRoadTypes(rts) || !HasRoadTypesAvail(_current_player, rts)) return CMD_ERROR; @@ -1319,14 +1319,17 @@ CommandCost CmdBuildRoadStop(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) /* Not allowed to build over this road */ if (build_over_road) { - if (IsTileOwner(tile, OWNER_TOWN) && !_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD); - 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; + if (road_owner == OWNER_TOWN) { + town_owned_road = true; + if (!_patches.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD); + } else { + if (road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR; + } } /* there is a tram, check if we can build road+tram stop over it */ |