Changeset - r15886:9bf3f985d8c3
[Not reviewed]
master
0 5 0
frosch - 14 years ago 2010-08-20 12:50:59
frosch@openttd.org
(svn r20579) -Change (r1579): Allow removing of buoys if they are only used by own vehicles.
5 files changed with 8 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -3548,7 +3548,7 @@ STR_ERROR_CAN_T_CHANGE_WAYPOINT_NAME    
 
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...
src/station_cmd.cpp
Show inline comments
 
@@ -2331,15 +2331,15 @@ static CommandCost RemoveAirport(TileInd
 

	
 
/**
 
 * 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) {
src/station_func.h
Show inline comments
 
@@ -34,7 +34,7 @@ void UpdateStationAcceptance(Station *st
 
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);
src/station_gui.cpp
Show inline comments
 
@@ -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++) {
src/waypoint_cmd.cpp
Show inline comments
 
@@ -333,7 +333,7 @@ CommandCost RemoveBuoy(TileIndex tile, D
 

	
 
	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);
0 comments (0 inline, 0 general)