(svn r16397) -Codechange: move GetVehicleOrder/GetLastVehicleOrder into Vehicle

This commit is contained in:
rubidium
2009-05-23 12:27:42 +00:00
parent 730b411878
commit 6cfc38b97c
8 changed files with 60 additions and 51 deletions

View File

@@ -470,6 +470,25 @@ public:
if (this->cur_order_index >= this->GetNumOrders()) this->cur_order_index = 0;
InvalidateVehicleOrder(this, 0);
}
/**
* Returns order 'index' of a vehicle or NULL when it doesn't exists
* @param index the order to fetch
* @return the found (or not) order
*/
inline Order *GetOrder(int index) const
{
return (this->orders.list == NULL) ? NULL : this->orders.list->GetOrderAt(index);
}
/**
* Returns the last order of a vehicle, or NULL if it doesn't exists
* @return last order of a vehicle, if available
*/
inline Order *GetLastOrder() const
{
return (this->orders.list == NULL) ? NULL : this->orders.list->GetLastOrder();
}
};
/**
@@ -520,16 +539,6 @@ struct FreeUnitIDGenerator {
~FreeUnitIDGenerator() { free(this->cache); }
};
/* Returns order 'index' of a vehicle or NULL when it doesn't exists */
static inline Order *GetVehicleOrder(const Vehicle *v, int index) { return (v->orders.list == NULL) ? NULL : v->orders.list->GetOrderAt(index); }
/**
* Returns the last order of a vehicle, or NULL if it doesn't exists
* @param v Vehicle to query
* @return last order of a vehicle, if available
*/
static inline Order *GetLastVehicleOrder(const Vehicle *v) { return (v->orders.list == NULL) ? NULL : v->orders.list->GetLastOrder(); }
void CheckVehicle32Day(Vehicle *v);
static const int32 INVALID_COORD = 0x7fffffff;