12 #ifndef VEHICLE_BASE_H
13 #define VEHICLE_BASE_H
150 cargo(cargo), capacity(capacity), remaining(remaining) {}
156 typedef std::list<RefitDesc> RefitList;
157 typedef std::map<CargoID, uint> CapacitiesMap;
295 uint GetConsistTotalCapacity()
const;
329 return (this->
direction & 1) ? speed : speed * 3 / 4;
346 return speed * 3 / 4;
358 return (this->
direction & 1) ? 192 : 256;
404 for (
Vehicle *u =
this; u != NULL; u = u->
Next()) {
405 u->InvalidateNewGRFCache();
460 assert(
this == this->
First());
470 virtual bool Tick() {
return true; };
482 virtual uint
Crash(
bool flooded =
false);
545 while (v->
Next() != NULL) v = v->
Next();
556 while (v->
Next() != NULL) v = v->
Next();
569 for (
int i = 0; i != n && v != NULL; i--) v = v->
Previous();
571 for (
int i = 0; i != n && v != NULL; i++) v = v->
Next();
585 for (
int i = 0; i != n && v != NULL; i--) v = v->
Previous();
587 for (
int i = 0; i != n && v != NULL; i++) v = v->
Next();
643 return (this->
orders.list == NULL) ? INVALID_STATION : this->
orders.list->GetNextStoppingStation(
this);
706 inline void SetServiceInterval(uint16 interval) { this->
service_interval = interval; }
802 return (this->
orders.list == NULL) ? NULL : this->
orders.list->GetOrderAt(index);
811 return (this->
orders.list == NULL) ? NULL : this->
orders.list->GetLastOrder();
921 #define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
927 #define FOR_ALL_VEHICLES(var) FOR_ALL_VEHICLES_FROM(var, 0)
933 template <
class T, VehicleType Type>
1053 assert(v->
type == Type);
1064 assert(v->
type == Type);
1065 return (
const T *)v;
1077 if (update_delta) ((T *)
this)->T::UpdateDeltaXY(this->
direction);
1089 #define FOR_ALL_VEHICLES_OF_TYPE(name, var) FOR_ALL_ITEMS_FROM(name, vehicle_index, var, 0) if (var->type == name::EXPECTED_TYPE)