mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 22:28:56 +00:00
(svn r21466) -Codechange: make VehicleHasDepotOrders a function of Vehicle.
This commit is contained in:
parent
fc70825905
commit
23369337c1
@ -1445,17 +1445,14 @@ void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Checks if a vehicle has a depot in its order list.
|
||||||
* Checks if a vehicle has a GOTO_DEPOT in his order list
|
* @return True iff at least one order is a depot order.
|
||||||
*
|
|
||||||
* @return True if this is true (lol ;))
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
bool VehicleHasDepotOrders(const Vehicle *v)
|
bool Vehicle::HasDepotOrder() const
|
||||||
{
|
{
|
||||||
const Order *order;
|
const Order *order;
|
||||||
|
|
||||||
FOR_VEHICLE_ORDERS(v, order) {
|
FOR_VEHICLE_ORDERS(this, order) {
|
||||||
if (order->IsType(OT_GOTO_DEPOT)) return true;
|
if (order->IsType(OT_GOTO_DEPOT)) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
/* Functions */
|
/* Functions */
|
||||||
void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination);
|
void RemoveOrderFromAllVehicles(OrderType type, DestinationID destination);
|
||||||
void InvalidateVehicleOrder(const Vehicle *v, int data);
|
void InvalidateVehicleOrder(const Vehicle *v, int data);
|
||||||
bool VehicleHasDepotOrders(const Vehicle *v);
|
|
||||||
void CheckOrders(const Vehicle*);
|
void CheckOrders(const Vehicle*);
|
||||||
void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false);
|
void DeleteVehicleOrders(Vehicle *v, bool keep_orderlist = false);
|
||||||
bool ProcessOrders(Vehicle *v);
|
bool ProcessOrders(Vehicle *v);
|
||||||
|
@ -158,8 +158,8 @@ bool Vehicle::NeedsServicing() const
|
|||||||
|
|
||||||
bool Vehicle::NeedsAutomaticServicing() const
|
bool Vehicle::NeedsAutomaticServicing() const
|
||||||
{
|
{
|
||||||
if (_settings_game.order.gotodepot && VehicleHasDepotOrders(this)) 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_LOADING)) return false;
|
||||||
if (this->current_order.IsType(OT_GOTO_DEPOT) && this->current_order.GetDepotOrderType() != ODTFB_SERVICE) return false;
|
if (this->current_order.IsType(OT_GOTO_DEPOT) && this->current_order.GetDepotOrderType() != ODTFB_SERVICE) return false;
|
||||||
return NeedsServicing();
|
return NeedsServicing();
|
||||||
}
|
}
|
||||||
|
@ -658,6 +658,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool IsEngineCountable() const;
|
bool IsEngineCountable() const;
|
||||||
|
bool HasDepotOrder() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
|
#define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
|
||||||
|
Loading…
Reference in New Issue
Block a user