12 #ifndef VEHICLE_BASE_H
13 #define VEHICLE_BASE_H
151 cargo(cargo), capacity(capacity), remaining(remaining) {}
157 typedef std::list<RefitDesc> RefitList;
158 typedef std::map<CargoID, uint> CapacitiesMap;
296 uint GetConsistTotalCapacity()
const;
330 return (this->
direction & 1) ? speed : speed * 3 / 4;
347 return speed * 3 / 4;
359 return (this->
direction & 1) ? 192 : 256;
405 for (
Vehicle *u =
this; u != NULL; u = u->
Next()) {
406 u->InvalidateNewGRFCache();
461 assert(
this == this->
First());
471 virtual bool Tick() {
return true; };
483 virtual uint
Crash(
bool flooded =
false);
546 while (v->
Next() != NULL) v = v->
Next();
557 while (v->
Next() != NULL) v = v->
Next();
570 for (
int i = 0; i != n && v != NULL; i--) v = v->
Previous();
572 for (
int i = 0; i != n && v != NULL; i++) v = v->
Next();
586 for (
int i = 0; i != n && v != NULL; i--) v = v->
Previous();
588 for (
int i = 0; i != n && v != NULL; i++) v = v->
Next();
644 return (this->
orders.list == NULL) ? INVALID_STATION : this->
orders.list->GetNextStoppingStation(
this);
707 inline void SetServiceInterval(uint16 interval) { this->
service_interval = interval; }
803 return (this->
orders.list == NULL) ? NULL : this->
orders.list->GetOrderAt(index);
812 return (this->
orders.list == NULL) ? NULL : this->
orders.list->GetLastOrder();
922 #define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
928 #define FOR_ALL_VEHICLES(var) FOR_ALL_VEHICLES_FROM(var, 0)
934 template <
class T, VehicleType Type>
1054 assert(v->
type == Type);
1065 assert(v->
type == Type);
1066 return (
const T *)v;
1081 if (update_delta) ((T *)
this)->T::UpdateDeltaXY(this->
direction);
1093 #define FOR_ALL_VEHICLES_OF_TYPE(name, var) FOR_ALL_ITEMS_FROM(name, vehicle_index, var, 0) if (var->type == name::EXPECTED_TYPE)