12 #ifndef VEHICLE_BASE_H
13 #define VEHICLE_BASE_H
136 return this->count == other.count && MemCmpT<PalSpriteID>(this->seq, other.seq, this->count) == 0;
141 return !this->operator==(other);
149 return this->count != 0;
166 this->seq[0].
sprite = sprite;
167 this->seq[0].
pal = 0;
175 this->count = src.count;
176 for (uint i = 0; i < src.count; ++i) {
178 this->seq[i].
pal = 0;
183 void Draw(
int x,
int y,
PaletteID default_pal,
bool force_pal)
const;
208 cargo(cargo), capacity(capacity), remaining(remaining) {}
214 typedef std::list<RefitDesc> RefitList;
215 typedef std::map<CargoID, uint> CapacitiesMap;
353 uint GetConsistTotalCapacity()
const;
387 return (this->
direction & 1) ? speed : speed * 3 / 4;
404 return speed * 3 / 4;
416 return (this->
direction & 1) ? 192 : 256;
462 for (
Vehicle *u =
this; u != NULL; u = u->
Next()) {
463 u->InvalidateNewGRFCache();
518 assert(
this == this->
First());
528 virtual bool Tick() {
return true; };
540 virtual uint
Crash(
bool flooded =
false);
603 while (v->
Next() != NULL) v = v->
Next();
614 while (v->
Next() != NULL) v = v->
Next();
627 for (
int i = 0; i != n && v != NULL; i--) v = v->
Previous();
629 for (
int i = 0; i != n && v != NULL; i++) v = v->
Next();
643 for (
int i = 0; i != n && v != NULL; i--) v = v->
Previous();
645 for (
int i = 0; i != n && v != NULL; i++) v = v->
Next();
701 return (this->
orders.list == NULL) ? INVALID_STATION : this->
orders.list->GetNextStoppingStation(
this);
764 inline void SetServiceInterval(uint16 interval) { this->
service_interval = interval; }
860 return (this->
orders.list == NULL) ? NULL : this->
orders.list->GetOrderAt(index);
869 return (this->
orders.list == NULL) ? NULL : this->
orders.list->GetLastOrder();
979 #define FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
985 #define FOR_ALL_VEHICLES(var) FOR_ALL_VEHICLES_FROM(var, 0)
991 template <
class T, VehicleType Type>
1114 assert(v->
type == Type);
1125 assert(v->
type == Type);
1126 return (
const T *)v;
1141 if (update_delta) ((T *)
this)->T::UpdateDeltaXY(this->
direction);
1144 if (force_update || this->
sprite_seq != seq) {
1156 #define FOR_ALL_VEHICLES_OF_TYPE(name, var) FOR_ALL_ITEMS_FROM(name, vehicle_index, var, 0) if (var->type == name::EXPECTED_TYPE)