diff options
-rw-r--r-- | src/lang/english.txt | 2 | ||||
-rw-r--r-- | src/station_cmd.cpp | 8 | ||||
-rw-r--r-- | src/station_func.h | 2 | ||||
-rw-r--r-- | src/station_gui.cpp | 2 | ||||
-rw-r--r-- | src/waypoint_cmd.cpp | 2 |
5 files changed, 8 insertions, 8 deletions
diff --git a/src/lang/english.txt b/src/lang/english.txt index 2b2f6bbfa..9ab03877c 100644 --- a/src/lang/english.txt +++ b/src/lang/english.txt @@ -3548,7 +3548,7 @@ STR_ERROR_CAN_T_CHANGE_WAYPOINT_NAME :{WHITE}Can't ch STR_ERROR_CAN_T_REMOVE_TRAIN_WAYPOINT :{WHITE}Can't remove train waypoint here... STR_ERROR_MUST_REMOVE_RAILWAYPOINT_FIRST :{WHITE}Must remove rail waypoint first STR_ERROR_BUOY_IN_THE_WAY :{WHITE}... buoy in the way -STR_ERROR_BUOY_IS_IN_USE :{WHITE}... buoy is in use! +STR_ERROR_BUOY_IS_IN_USE :{WHITE}... buoy is in use by another company! # Depot related errors STR_ERROR_CAN_T_BUILD_TRAIN_DEPOT :{WHITE}Can't build train depot here... diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index 26a6cbd48..a8c7737fd 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2331,15 +2331,15 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags) /** * Tests whether the company's vehicles have this station in orders - * When company == INVALID_COMPANY, then check all vehicles * @param station station ID - * @param company company ID, INVALID_COMPANY to disable the check + * @param include_company If true only check vehicles of \a company, if false only check vehicles of other companies + * @param company company ID */ -bool HasStationInUse(StationID station, CompanyID company) +bool HasStationInUse(StationID station, bool include_company, CompanyID company) { const Vehicle *v; FOR_ALL_VEHICLES(v) { - if (company == INVALID_COMPANY || v->owner == company) { + if ((v->owner == company) == include_company) { const Order *order; FOR_VEHICLE_ORDERS(v, order) { if ((order->IsType(OT_GOTO_STATION) || order->IsType(OT_GOTO_WAYPOINT)) && order->GetDestination() == station) { diff --git a/src/station_func.h b/src/station_func.h index 2a2d8314d..245aa8f63 100644 --- a/src/station_func.h +++ b/src/station_func.h @@ -34,7 +34,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg); const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx); void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image); -bool HasStationInUse(StationID station, CompanyID company); +bool HasStationInUse(StationID station, bool include_company, CompanyID company); RoadStop *GetRoadStopByTile(TileIndex tile, RoadStopType type); uint GetNumRoadStops(const Station *st, RoadStopType type); diff --git a/src/station_gui.cpp b/src/station_gui.cpp index b290a1b84..97dbf5c72 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -234,7 +234,7 @@ protected: const Station *st; FOR_ALL_STATIONS(st) { - if (st->owner == owner || (st->owner == OWNER_NONE && HasStationInUse(st->index, owner))) { + if (st->owner == owner || (st->owner == OWNER_NONE && HasStationInUse(st->index, true, owner))) { if (this->facilities & st->facilities) { // only stations with selected facilities int num_waiting_cargo = 0; for (CargoID j = 0; j < NUM_CARGO; j++) { diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 4d2520c25..9a0954aef 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -333,7 +333,7 @@ CommandCost RemoveBuoy(TileIndex tile, DoCommandFlag flags) Waypoint *wp = Waypoint::GetByTile(tile); - if (HasStationInUse(wp->index, INVALID_COMPANY)) return_cmd_error(STR_ERROR_BUOY_IS_IN_USE); + if (HasStationInUse(wp->index, false, _current_company)) return_cmd_error(STR_ERROR_BUOY_IS_IN_USE); /* remove the buoy if there is a ship on tile when company goes bankrupt... */ if (!(flags & DC_BANKRUPT)) { CommandCost ret = EnsureNoVehicleOnGround(tile); |