summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2011-02-20 15:19:16 +0000
committerfrosch <frosch@openttd.org>2011-02-20 15:19:16 +0000
commitbd9610ec3c973f5fba8037d4b0e877ccb0f0a38d (patch)
tree3fed667e13fef59128dcf393322d2458da93525d
parent756cc6cf651aa5650f055c70f31f7e07391be8c6 (diff)
downloadopenttd-bd9610ec3c973f5fba8037d4b0e877ccb0f0a38d.tar.xz
(svn r22117) -Fix [FS#4523-ish]: CanRemoveRoadWithStop() failed for _current_company = OWNER_TOWN, and for OWNER_NONE-owned road.
-rw-r--r--src/station_cmd.cpp21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index 4d64b3c03..98b919870 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -3452,16 +3452,21 @@ static bool CanRemoveRoadWithStop(TileIndex tile, DoCommandFlag flags)
/* Yeah... water can always remove stops, right? */
if (_current_company == OWNER_WATER) return true;
- Owner road_owner = _current_company;
- Owner tram_owner = _current_company;
-
RoadTypes rts = GetRoadTypes(tile);
- if (HasBit(rts, ROADTYPE_ROAD)) road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
- if (HasBit(rts, ROADTYPE_TRAM)) tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
-
- if ((road_owner != OWNER_TOWN && CheckOwnership(road_owner).Failed()) || CheckOwnership(tram_owner).Failed()) return false;
+ if (HasBit(rts, ROADTYPE_TRAM)) {
+ Owner tram_owner = GetRoadOwner(tile, ROADTYPE_TRAM);
+ if (tram_owner != OWNER_NONE && CheckOwnership(tram_owner).Failed()) return false;
+ }
+ if (HasBit(rts, ROADTYPE_ROAD)) {
+ Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
+ if (road_owner != OWNER_TOWN) {
+ if (road_owner != OWNER_NONE && CheckOwnership(road_owner).Failed()) return false;
+ } else {
+ if (CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_ROAD), OWNER_TOWN, ROADTYPE_ROAD, flags).Failed()) return false;
+ }
+ }
- return road_owner != OWNER_TOWN || CheckAllowRemoveRoad(tile, GetAnyRoadBits(tile, ROADTYPE_ROAD), OWNER_TOWN, ROADTYPE_ROAD, flags).Succeeded();
+ return true;
}
CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)