(svn r21466) -Codechange: make VehicleHasDepotOrders a function of Vehicle.

pull/155/head
rubidium 14 years ago
parent ff16d3a2f8
commit d5bdeb3589

@ -1445,17 +1445,14 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
}
/**
*
* 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;
}

@ -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);

@ -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();
}

@ -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)

Loading…
Cancel
Save