Changeset - r7490:4e86e893fa7f
[Not reviewed]
master
0 12 0
rubidium - 17 years ago 2007-08-29 21:49:08
rubidium@openttd.org
(svn r11001) -Codechange: unify the way to determine whether a vehicle is in a depot.
12 files changed with 55 insertions and 105 deletions:
0 comments (0 inline, 0 general)
src/ai/default/default.cpp
Show inline comments
 
@@ -338,7 +338,7 @@ static void AiHandleReplaceRoadVeh(Playe
 
	BackuppedOrders orderbak[1];
 
	EngineID veh;
 

	
 
	if (!IsRoadVehInDepotStopped(v)) {
 
	if (!v->IsStoppedInDepot()) {
 
		AiHandleGotoDepot(p, CMD_SEND_ROADVEH_TO_DEPOT);
 
		return;
 
	}
 
@@ -367,7 +367,7 @@ static void AiHandleReplaceAircraft(Play
 
	BackuppedOrders orderbak[1];
 
	EngineID veh;
 

	
 
	if (!IsAircraftInHangarStopped(v)) {
 
	if (!v->IsStoppedInDepot()) {
 
		AiHandleGotoDepot(p, CMD_SEND_AIRCRAFT_TO_HANGAR);
 
		return;
 
	}
 
@@ -3578,7 +3578,7 @@ static void AiStateSellVeh(Player *p)
 
			DoCommand(v->tile, v->index, 1, DC_EXEC, CMD_SELL_RAIL_WAGON);
 

	
 
		} else if (v->type == VEH_ROAD) {
 
			if (!IsRoadVehInDepotStopped(v)) {
 
			if (!v->IsStoppedInDepot()) {
 
				if (v->current_order.type != OT_GOTO_DEPOT)
 
					DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
 
				goto going_to_depot;
 
@@ -3586,7 +3586,7 @@ static void AiStateSellVeh(Player *p)
 

	
 
			DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
 
		} else if (v->type == VEH_AIRCRAFT) {
 
			if (!IsAircraftInHangarStopped(v)) {
 
			if (!v->IsStoppedInDepot()) {
 
				if (v->current_order.type != OT_GOTO_DEPOT)
 
					DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
 
				goto going_to_depot;
src/aircraft.h
Show inline comments
 
@@ -33,25 +33,6 @@ static inline bool IsNormalAircraft(cons
 
	return v->subtype <= AIR_AIRCRAFT;
 
}
 

	
 
/** Check if this aircraft is in a hangar
 
 * @param v vehicle to check
 
 * @return true if in hangar
 
 */
 
static inline bool IsAircraftInHangar(const Vehicle *v)
 
{
 
	assert(v->type == VEH_AIRCRAFT);
 
	return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
 
}
 

	
 
/** Check if this aircraft is in a hangar and stopped
 
 * @param v vehicle to check
 
 * @return true if in hangar and stopped
 
 */
 
static inline bool IsAircraftInHangarStopped(const Vehicle *v)
 
{
 
	return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
 
}
 

	
 
/** Checks if an aircraft is buildable at the tile in question
 
 * @param engine The engine to test
 
 * @param tile The tile where the hangar is
 
@@ -133,6 +114,7 @@ struct Aircraft : public Vehicle {
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
 
	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 16; }
 
	Money GetRunningCost() const { return AircraftVehInfo(this->engine_type)->running_cost * _price.aircraft_running; }
 
	bool IsInDepot() const { return (this->vehstatus & VS_HIDDEN) != 0 && IsHangarTile(this->tile); }
 
	void Tick();
 
};
 

	
src/aircraft_cmd.cpp
Show inline comments
 
@@ -485,7 +485,7 @@ CommandCost CmdSellAircraft(TileIndex ti
 
	Vehicle *v = GetVehicle(p1);
 

	
 
	if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
 
	if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
 
	if (!v->IsStoppedInDepot()) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 

	
 
@@ -526,7 +526,7 @@ CommandCost CmdStartStopAircraft(TileInd
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		if (IsAircraftInHangarStopped(v)) {
 
		if (v->IsStoppedInDepot()) {
 
			DeleteVehicleNews(p1, STR_A014_AIRCRAFT_IS_WAITING_IN);
 
		}
 

	
 
@@ -560,7 +560,7 @@ CommandCost CmdSendAircraftToHangar(Tile
 

	
 
	Vehicle *v = GetVehicle(p1);
 

	
 
	if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
 
	if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || v->IsInDepot()) return CMD_ERROR;
 

	
 
	if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
 
		if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
 
@@ -634,7 +634,7 @@ CommandCost CmdRefitAircraft(TileIndex t
 
	Vehicle *v = GetVehicle(p1);
 

	
 
	if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
 
	if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
 
	if (!v->IsStoppedInDepot()) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
 

	
 
	/* Check cargo */
 
	CargoID new_cid = GB(p2, 0, 8);
 
@@ -706,7 +706,7 @@ static void CheckIfAircraftNeedsService(
 

	
 
	if (_patches.gotodepot && VehicleHasDepotOrders(v)) return;
 

	
 
	if (IsAircraftInHangar(v)) {
 
		if (v->IsInDepot()) {
 
		VehicleServiceInDepot(v);
 
		return;
 
	}
src/group_gui.cpp
Show inline comments
 
@@ -458,7 +458,7 @@ static void GroupWndProc(Window *w, Wind
 
				DrawVehicleProfitButton(v, x, y2 + 13);
 

	
 
				SetDParam(0, v->unitnumber);
 
				DrawString(x, y2 + 2, IsVehicleInDepot(v) ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), 0);
 
				DrawString(x, y2 + 2, v->IsInDepot() ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), 0);
 

	
 
				if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG2) DrawSmallOrderList(v, x + 138, y2);
 

	
src/roadveh.h
Show inline comments
 
@@ -45,17 +45,6 @@ static inline bool RoadVehHasArticPart(c
 
}
 

	
 

	
 
static inline bool IsRoadVehInDepot(const Vehicle *v)
 
{
 
	assert(v->type == VEH_ROAD);
 
	return v->u.road.state == 254;
 
}
 

	
 
static inline bool IsRoadVehInDepotStopped(const Vehicle *v)
 
{
 
	return IsRoadVehInDepot(v) && v->vehstatus & VS_STOPPED;
 
}
 

	
 
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2);
 

	
 

	
 
@@ -85,6 +74,7 @@ struct RoadVehicle : public Vehicle {
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
 
	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
 
	Money GetRunningCost() const { return RoadVehInfo(this->engine_type)->running_cost * _price.roadveh_running; }
 
	bool IsInDepot() const { return this->u.road.state == RVSB_IN_DEPOT; }
 
	void Tick();
 
};
 

	
src/roadveh_cmd.cpp
Show inline comments
 
@@ -304,7 +304,7 @@ CommandCost CmdStartStopRoadVeh(TileInde
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		if (IsRoadVehInDepotStopped(v)) {
 
		if (v->IsStoppedInDepot()) {
 
			DeleteVehicleNews(p1, STR_9016_ROAD_VEHICLE_IS_WAITING);
 
		}
 

	
 
@@ -469,7 +469,7 @@ CommandCost CmdSendRoadVehToDepot(TileIn
 

	
 
	if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
 

	
 
	if (IsRoadVehInDepot(v)) return CMD_ERROR;
 
	if (v->IsInDepot()) return CMD_ERROR;
 

	
 
	/* If the current orders are already goto-depot */
 
	if (v->current_order.type == OT_GOTO_DEPOT) {
 
@@ -538,7 +538,7 @@ CommandCost CmdTurnRoadVeh(TileIndex til
 
			v->breakdown_ctr != 0 ||
 
			v->u.road.overtaking != 0 ||
 
			v->u.road.state == RVSB_WORMHOLE ||
 
			IsRoadVehInDepot(v) ||
 
			v->IsInDepot() ||
 
			v->cur_speed < 5) {
 
		return CMD_ERROR;
 
	}
 
@@ -865,7 +865,7 @@ static void* EnumCheckRoadVehClose(Vehic
 

	
 
	return
 
		v->type == VEH_ROAD &&
 
		!IsRoadVehInDepot(v) &&
 
		!v->IsInDepot() &&
 
		myabs(v->z_pos - rvf->veh->z_pos) < 6 &&
 
		v->direction == rvf->dir &&
 
		GetFirstVehicleInChain(rvf->veh) != GetFirstVehicleInChain(v) &&
 
@@ -1439,7 +1439,7 @@ static bool IndividualRoadVehicleControl
 
	/* If this vehicle is in a depot and we've reached this point it must be
 
	 * one of the articulated parts. It will stay in the depot until activated
 
	 * by the previous vehicle in the chain when it gets to the right place. */
 
	if (IsRoadVehInDepot(v)) return true;
 
	if (v->IsInDepot()) return true;
 

	
 
	/* Save old vehicle position to use at end of move to set viewport area dirty */
 
	BeginVehicleMove(v);
 
@@ -1817,7 +1817,7 @@ static void RoadVehController(Vehicle *v
 

	
 
	if (v->current_order.type == OT_LOADING) return;
 

	
 
	if (IsRoadVehInDepot(v) && RoadVehLeaveDepot(v, true)) return;
 
	if (v->IsInDepot() && RoadVehLeaveDepot(v, true)) return;
 

	
 
	/* Check if vehicle needs to proceed, return if it doesn't */
 
	if (!RoadVehAccelerate(v)) return;
 
@@ -1858,7 +1858,7 @@ static void CheckIfRoadVehNeedsService(V
 
	/* If we already got a slot at a stop, use that FIRST, and go to a depot later */
 
	if (v->u.road.slot != NULL) return;
 

	
 
	if (IsRoadVehInDepot(v)) {
 
	if (v->IsInDepot()) {
 
		VehicleServiceInDepot(v);
 
		return;
 
	}
src/ship.h
Show inline comments
 
@@ -13,18 +13,6 @@ void CcBuildShip(bool success, TileIndex
 
void RecalcShipStuff(Vehicle *v);
 
void GetShipSpriteSize(EngineID engine, uint &width, uint &height);
 

	
 
static inline bool IsShipInDepot(const Vehicle *v)
 
{
 
	assert(v->type == VEH_SHIP);
 
	return v->u.ship.state == 0x80;
 
}
 

	
 
static inline bool IsShipInDepotStopped(const Vehicle *v)
 
{
 
	return IsShipInDepot(v) && v->vehstatus & VS_STOPPED;
 
}
 

	
 

	
 
/**
 
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
 
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
 
@@ -51,6 +39,7 @@ struct Ship: public Vehicle {
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 32; }
 
	int GetDisplayMaxSpeed() const { return this->max_speed * 10 / 32; }
 
	Money GetRunningCost() const { return ShipVehInfo(this->engine_type)->running_cost * _price.ship_running; }
 
	bool IsInDepot() const { return this->u.ship.state == 0x80; }
 
	void Tick();
 
};
 

	
src/ship_cmd.cpp
Show inline comments
 
@@ -152,7 +152,7 @@ static void CheckIfShipNeedsService(Vehi
 

	
 
	if (_patches.gotodepot && VehicleHasDepotOrders(v)) return;
 

	
 
	if (IsShipInDepot(v)) {
 
	if (v->IsInDepot()) {
 
		VehicleServiceInDepot(v);
 
		return;
 
	}
 
@@ -355,7 +355,7 @@ static void CheckShipLeaveDepot(Vehicle 
 
	Axis axis;
 
	uint m;
 

	
 
	if (!IsShipInDepot(v)) return;
 
	if (!v->IsInDepot()) return;
 

	
 
	tile = v->tile;
 
	axis = GetShipDepotAxis(tile);
 
@@ -678,7 +678,7 @@ static void ShipController(Vehicle *v)
 
	GetNewVehiclePosResult gp = GetNewVehiclePos(v);
 
	if (gp.old_tile == gp.new_tile) {
 
		/* Staying in tile */
 
		if (IsShipInDepot(v)) {
 
		if (v->IsInDepot()) {
 
			gp.x = v->x_pos;
 
			gp.y = v->y_pos;
 
		} else {
 
@@ -925,7 +925,7 @@ CommandCost CmdSellShip(TileIndex tile, 
 

	
 
	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 

	
 
	if (!IsShipInDepotStopped(v)) {
 
	if (!v->IsStoppedInDepot()) {
 
		return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
 
	}
 

	
 
@@ -967,7 +967,7 @@ CommandCost CmdStartStopShip(TileIndex t
 
	}
 

	
 
	if (flags & DC_EXEC) {
 
		if (IsShipInDepotStopped(v)) {
 
		if (v->IsStoppedInDepot()) {
 
			DeleteVehicleNews(p1, STR_981C_SHIP_IS_WAITING_IN_DEPOT);
 
		}
 

	
 
@@ -1007,7 +1007,7 @@ CommandCost CmdSendShipToDepot(TileIndex
 

	
 
	if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
 

	
 
	if (IsShipInDepot(v)) return CMD_ERROR;
 
	if (v->IsInDepot()) return CMD_ERROR;
 

	
 
	/* If the current orders are already goto-depot */
 
	if (v->current_order.type == OT_GOTO_DEPOT) {
 
@@ -1079,7 +1079,7 @@ CommandCost CmdRefitShip(TileIndex tile,
 

	
 
	if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
 

	
 
	if (!IsShipInDepotStopped(v)) {
 
	if (!v->IsStoppedInDepot()) {
 
		return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
 
	}
 

	
src/train.h
Show inline comments
 
@@ -248,6 +248,9 @@ void CcBuildWagon(bool success, TileInde
 

	
 
byte FreightWagonMult(CargoID cargo);
 

	
 
int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped);
 
int CheckTrainStoppedInDepot(const Vehicle *v);
 

	
 
/**
 
 * This class 'wraps' Vehicle; you do not actually instantiate this class.
 
 * You create a Vehicle using AllocateVehicle, so it is added to the pool
 
@@ -275,6 +278,8 @@ struct Train : public Vehicle {
 
	int GetDisplaySpeed() const { return this->cur_speed * 10 / 16; }
 
	int GetDisplayMaxSpeed() const { return this->u.rail.cached_max_speed * 10 / 16; }
 
	Money GetRunningCost() const;
 
	bool IsInDepot() const { return CheckTrainInDepot(this, false) != -1; }
 
	bool IsStoppedInDepot() const { return CheckTrainStoppedInDepot(this) >= 0; }
 
	void Tick();
 
};
 

	
src/vehicle.cpp
Show inline comments
 
@@ -1700,7 +1700,7 @@ CommandCost CmdDepotMassAutoReplace(Tile
 
		CommandCost ret;
 

	
 
		/* Ensure that the vehicle completely in the depot */
 
		if (!IsVehicleInDepot(v)) continue;
 
		if (!v->IsInDepot()) continue;
 

	
 
		x = v->x_pos;
 
		y = v->y_pos;
 
@@ -1958,7 +1958,7 @@ void BuildDepotVehicleList(VehicleType t
 

	
 
		case VEH_ROAD:
 
			FOR_ALL_VEHICLES(v) {
 
				if (v->tile == tile && v->type == VEH_ROAD && IsRoadVehInDepot(v) && IsRoadVehFront(v)) {
 
				if (v->tile == tile && v->type == VEH_ROAD && v->IsInDepot() && IsRoadVehFront(v)) {
 
					if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
 
					(*engine_list)[(*engine_count)++] = v;
 
				}
 
@@ -1967,7 +1967,7 @@ void BuildDepotVehicleList(VehicleType t
 

	
 
		case VEH_SHIP:
 
			FOR_ALL_VEHICLES(v) {
 
				if (v->tile == tile && v->type == VEH_SHIP && IsShipInDepot(v)) {
 
				if (v->tile == tile && v->type == VEH_SHIP && v->IsInDepot()) {
 
					if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
 
					(*engine_list)[(*engine_count)++] = v;
 
				}
 
@@ -1978,7 +1978,7 @@ void BuildDepotVehicleList(VehicleType t
 
			FOR_ALL_VEHICLES(v) {
 
				if (v->tile == tile &&
 
						v->type == VEH_AIRCRAFT && IsNormalAircraft(v) &&
 
						v->vehstatus & VS_HIDDEN) {
 
						v->IsInDepot()) {
 
					if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
 
					(*engine_list)[(*engine_count)++] = v;
 
				}
 
@@ -2133,30 +2133,6 @@ CommandCost SendAllVehiclesToDepot(Vehic
 
	return (flags & DC_EXEC) ? CommandCost() : CMD_ERROR;
 
}
 

	
 
bool IsVehicleInDepot(const Vehicle *v)
 
{
 
	switch (v->type) {
 
		case VEH_TRAIN:    return CheckTrainInDepot(v, false) != -1;
 
		case VEH_ROAD:     return IsRoadVehInDepot(v);
 
		case VEH_SHIP:     return IsShipInDepot(v);
 
		case VEH_AIRCRAFT: return IsAircraftInHangar(v);
 
		default: NOT_REACHED();
 
	}
 
	return false;
 
}
 

	
 
bool IsVehicleInDepotStopped(const Vehicle *v)
 
{
 
	switch (v->type) {
 
		case VEH_TRAIN:    return CheckTrainStoppedInDepot(v) >= 0;
 
		case VEH_ROAD:     return IsRoadVehInDepotStopped(v);
 
		case VEH_SHIP:     return IsShipInDepotStopped(v);
 
		case VEH_AIRCRAFT: return IsAircraftInHangarStopped(v);
 
		default: NOT_REACHED();
 
	}
 
	return false;
 
}
 

	
 
/**
 
 * Calculates how full a vehicle is.
 
 * @param v The Vehicle to check. For trains, use the first engine.
 
@@ -2472,14 +2448,14 @@ Trackdir GetVehicleTrackdir(const Vehicl
 
			return TrackDirectionToTrackdir(FindFirstTrack(v->u.rail.track), v->direction);
 

	
 
		case VEH_SHIP:
 
			if (IsShipInDepot(v))
 
			if (v->IsInDepot())
 
				// We'll assume the ship is facing outwards
 
				return DiagdirToDiagTrackdir(GetShipDepotDirection(v->tile));
 

	
 
			return TrackDirectionToTrackdir(FindFirstTrack(v->u.ship.state), v->direction);
 

	
 
		case VEH_ROAD:
 
			if (IsRoadVehInDepot(v)) // We'll assume the road vehicle is facing outwards
 
			if (v->IsInDepot()) // We'll assume the road vehicle is facing outwards
 
				return DiagdirToDiagTrackdir(GetRoadDepotDirection(v->tile));
 

	
 
			if (IsStandardRoadStopTile(v->tile)) // We'll assume the road vehicle is facing outwards
src/vehicle.h
Show inline comments
 
@@ -433,6 +433,18 @@ struct Vehicle : PoolItem<Vehicle, Vehic
 
	virtual Money GetRunningCost() const { return 0; }
 

	
 
	/**
 
	 * Check whether the vehicle is in the depot.
 
	 * @return true if and only if the vehicle is in the depot.
 
	 */
 
	virtual bool IsInDepot() const { return false; }
 

	
 
	/**
 
	 * Check whether the vehicle is in the depot *and* stopped.
 
	 * @return true if and only if the vehicle is in the depot and stopped.
 
	 */
 
	virtual bool IsStoppedInDepot() const { return this->IsInDepot() && (this->vehstatus & VS_STOPPED) != 0; }
 

	
 
	/**
 
	 * Calls the tick handler of the vehicle
 
	 */
 
	virtual void Tick() {};
 
@@ -573,15 +585,11 @@ void TrainConsistChanged(Vehicle *v);
 
void TrainPowerChanged(Vehicle *v);
 
Money GetTrainRunningCost(const Vehicle *v);
 

	
 
int CheckTrainStoppedInDepot(const Vehicle *v);
 

	
 
bool VehicleNeedsService(const Vehicle *v);
 

	
 
uint GenerateVehicleSortList(const Vehicle*** sort_list, uint16 *length_of_array, VehicleType type, PlayerID owner, uint32 index, uint16 window_type);
 
void BuildDepotVehicleList(VehicleType type, TileIndex tile, Vehicle ***engine_list, uint16 *engine_list_length, uint16 *engine_count, Vehicle ***wagon_list, uint16 *wagon_list_length, uint16 *wagon_count);
 
CommandCost SendAllVehiclesToDepot(VehicleType type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id);
 
bool IsVehicleInDepot(const Vehicle *v);
 
bool IsVehicleInDepotStopped(const Vehicle *v);
 
void VehicleEnterDepot(Vehicle *v);
 

	
 
void InvalidateAutoreplaceWindow(EngineID e, GroupID id_g);
src/vehicle_gui.cpp
Show inline comments
 
@@ -1021,7 +1021,7 @@ static void DrawVehicleListWindow(Window
 

	
 
		if (w->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG) DrawSmallOrderList(v, x + 138, y);
 

	
 
		if (IsVehicleInDepot(v)) {
 
		if (v->IsInDepot()) {
 
			str = STR_021F;
 
		} else {
 
			str = (v->age > v->max_age - 366) ? STR_00E3 : STR_00E2;
 
@@ -1546,9 +1546,9 @@ static bool IsVehicleRefitable(const Veh
 
	 */
 
	switch (v->type) {
 
		case VEH_TRAIN:    return false;
 
		case VEH_ROAD:     return EngInfo(v->engine_type)->refit_mask != 0 && IsVehicleInDepotStopped(v);
 
		case VEH_SHIP:     return ShipVehInfo(v->engine_type)->refittable && IsVehicleInDepotStopped(v);
 
		case VEH_AIRCRAFT: return IsVehicleInDepotStopped(v);
 
		case VEH_ROAD:     return EngInfo(v->engine_type)->refit_mask != 0 && v->IsStoppedInDepot();
 
		case VEH_SHIP:     return ShipVehInfo(v->engine_type)->refittable && v->IsStoppedInDepot();
 
		case VEH_AIRCRAFT: return v->IsStoppedInDepot();
 
		default: NOT_REACHED();
 
	}
 
}
 
@@ -1790,7 +1790,7 @@ static void VehicleViewWndProc(Window *w
 

	
 
		case WE_MOUSELOOP: {
 
			const Vehicle *v = GetVehicle(w->window_number);
 
			bool veh_stopped = IsVehicleInDepotStopped(v);
 
			bool veh_stopped = v->IsStoppedInDepot();
 

	
 
			/* Widget VVW_WIDGET_GOTO_DEPOT must be hidden if the vehicle is already
 
			 * stopped in depot.
0 comments (0 inline, 0 general)