Changeset - r16723:9f6e29be2bde
[Not reviewed]
master
0 4 0
rubidium - 13 years ago 2010-12-11 13:48:30
rubidium@openttd.org
(svn r21466) -Codechange: make VehicleHasDepotOrders a function of Vehicle.
4 files changed with 7 insertions and 10 deletions:
0 comments (0 inline, 0 general)
src/order_cmd.cpp
Show inline comments
 
@@ -1445,17 +1445,14 @@ void RemoveOrderFromAllVehicles(OrderTyp
 
}
 

	
 
/**
 
 *
 
 * Checks if a vehicle has a GOTO_DEPOT in his order list
 
 *
 
 * @return True if this is true (lol ;))
 
 *
 
 * Checks if a vehicle has a depot in its order list.
 
 * @return True iff at least one order is a depot order.
 
 */
 
bool VehicleHasDepotOrders(const Vehicle *v)
 
bool Vehicle::HasDepotOrder() const
 
{
 
	const Order *order;
 

	
 
	FOR_VEHICLE_ORDERS(v, order) {
 
	FOR_VEHICLE_ORDERS(this, order) {
 
		if (order->IsType(OT_GOTO_DEPOT)) return true;
 
	}
 

	
src/order_func.h
Show inline comments
 
@@ -19,7 +19,6 @@
 
/* Functions */
 
void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination);
 
void InvalidateVehicleOrder(const Vehicle *v, int data);
 
bool VehicleHasDepotOrders(const Vehicle *v);
 
void CheckOrders(const Vehicle*);
 
void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false);
 
bool ProcessOrders(Vehicle *v);
src/vehicle.cpp
Show inline comments
 
@@ -158,8 +158,8 @@ bool Vehicle::NeedsServicing() const
 

	
 
bool Vehicle::NeedsAutomaticServicing() const
 
{
 
	if (_settings_game.order.gotodepot && VehicleHasDepotOrders(this)) return false;
 
	if (this->current_order.IsType(OT_LOADING))            return false;
 
	if (_settings_game.order.gotodepot && this->HasDepotOrder()) return false;
 
	if (this->current_order.IsType(OT_LOADING)) return false;
 
	if (this->current_order.IsType(OT_GOTO_DEPOT) && this->current_order.GetDepotOrderType() != ODTFB_SERVICE) return false;
 
	return NeedsServicing();
 
}
src/vehicle_base.h
Show inline comments
 
@@ -658,6 +658,7 @@ public:
 
	}
 

	
 
	bool IsEngineCountable() const;
 
	bool HasDepotOrder() const;
 
};
 

	
 
#define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
0 comments (0 inline, 0 general)