OpenTTD Source  14.0-beta3
vehicle_base.h
Go to the documentation of this file.
1 /*
2  * This file is part of OpenTTD.
3  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6  */
7 
10 #ifndef VEHICLE_BASE_H
11 #define VEHICLE_BASE_H
12 
13 #include "track_type.h"
14 #include "command_type.h"
15 #include "order_base.h"
16 #include "cargopacket.h"
17 #include "texteff.hpp"
18 #include "engine_type.h"
19 #include "order_func.h"
20 #include "transport_type.h"
21 #include "group_type.h"
22 #include "base_consist.h"
23 #include "network/network.h"
24 #include "saveload/saveload.h"
26 #include "core/mem_func.hpp"
27 
28 const uint TILE_AXIAL_DISTANCE = 192; // Logical length of the tile in any DiagDirection used in vehicle movement.
29 const uint TILE_CORNER_DISTANCE = 128; // Logical length of the tile corner crossing in any non-diagonal direction used in vehicle movement.
30 
32 enum VehStatus {
33  VS_HIDDEN = 0x01,
34  VS_STOPPED = 0x02,
35  VS_UNCLICKABLE = 0x04,
36  VS_DEFPAL = 0x08,
38  VS_SHADOW = 0x20,
40  VS_CRASHED = 0x80,
41 };
42 
55 };
56 
65 };
66 
68 struct NewGRFCache {
69  /* Values calculated when they are requested for the first time after invalidating the NewGRF cache. */
75  uint8_t cache_valid;
76 };
77 
83 
90 
94 
95  VE_DEFAULT = 0xFF,
96 };
97 
100  VESM_NONE = 0,
104 
105  VESM_END
106 };
107 
120 };
121 
123 struct VehicleCache {
124  uint16_t cached_max_speed;
126 
128 };
129 
132  PalSpriteID seq[8];
133  uint count;
134 
135  bool operator==(const VehicleSpriteSeq &other) const
136  {
137  return this->count == other.count && MemCmpT<PalSpriteID>(this->seq, other.seq, this->count) == 0;
138  }
139 
140  bool operator!=(const VehicleSpriteSeq &other) const
141  {
142  return !this->operator==(other);
143  }
144 
148  bool IsValid() const
149  {
150  return this->count != 0;
151  }
152 
156  void Clear()
157  {
158  this->count = 0;
159  }
160 
164  void Set(SpriteID sprite)
165  {
166  this->count = 1;
167  this->seq[0].sprite = sprite;
168  this->seq[0].pal = 0;
169  }
170 
175  {
176  this->count = src.count;
177  for (uint i = 0; i < src.count; ++i) {
178  this->seq[i].sprite = src.seq[i].sprite;
179  this->seq[i].pal = 0;
180  }
181  }
182 
183  void GetBounds(Rect *bounds) const;
184  void Draw(int x, int y, PaletteID default_pal, bool force_pal) const;
185 };
186 
197 };
198 
202 
203 /* Some declarations of functions, so we can make them friendly */
204 struct GroundVehicleCache;
205 struct LoadgameState;
206 extern bool LoadOldVehicle(LoadgameState *ls, int num);
207 extern void FixOldVehicles();
208 
209 struct GRFFile;
210 
214 struct RefitDesc {
216  uint16_t capacity;
217  uint16_t remaining;
218  RefitDesc(CargoID cargo, uint16_t capacity, uint16_t remaining) :
220 };
221 
226 struct ClosestDepot {
227  TileIndex location;
228  DestinationID destination;
229  bool reverse;
230  bool found;
231 
232  ClosestDepot() :
233  location(INVALID_TILE), destination(0), reverse(false), found(false) {}
234 
235  ClosestDepot(TileIndex location, DestinationID destination, bool reverse = false) :
236  location(location), destination(destination), reverse(reverse), found(true) {}
237 };
238 
241 private:
242  typedef std::list<RefitDesc> RefitList;
243 
247 
250 
251 public:
252  friend void FixOldVehicles();
253  friend void AfterLoadVehicles(bool part_of_load);
254  friend bool LoadOldVehicle(LoadgameState *ls, int num);
255  /* So we can use private/protected variables in the saveload code */
256  friend class SlVehicleCommon;
257  friend class SlVehicleDisaster;
258  friend void Ptrs_VEHS();
259 
261 
268 
272 
274 
275  mutable Rect coord;
276 
279 
283 
285 
286  /* Related to age and service time */
290  TimerGameEconomy::Date date_of_last_service;
292  uint16_t reliability;
298 
299  int32_t x_pos;
300  int32_t y_pos;
301  int32_t z_pos;
303 
305 
310  byte spritenum;
311  byte x_extent;
312  byte y_extent;
313  byte z_extent;
314  int8_t x_bb_offs;
315  int8_t y_bb_offs;
316  int8_t x_offs;
317  int8_t y_offs;
319 
320  TextEffectID fill_percent_te_id;
322 
323  uint16_t cur_speed;
324  byte subspeed;
326  uint32_t motion_counter;
327  byte progress;
328 
329  uint16_t random_bits;
331 
335 
338  uint16_t cargo_cap;
339  uint16_t refit_cap;
341  uint16_t cargo_age_counter;
342  int8_t trip_occupancy;
343 
344  byte day_counter;
347 
348  byte vehstatus;
350 
351  union {
354  };
355 
356  uint16_t load_unload_ticks;
358  byte subtype;
359 
362 
364 
369  virtual uint16_t GetMaxWeight() const
370  {
371  return 0;
372  }
373 
375 
376  void PreDestructor();
378  virtual ~Vehicle();
379 
380  void BeginLoading();
381  void CancelReservation(StationID next, Station *st);
382  void LeaveStation();
383 
386 
387  uint16_t &GetGroundVehicleFlags();
388  const uint16_t &GetGroundVehicleFlags() const;
389 
391 
392  void HandleLoading(bool mode = false);
393 
402  virtual void MarkDirty() {}
403 
408  virtual void UpdateDeltaXY() {}
409 
423  inline uint GetOldAdvanceSpeed(uint speed)
424  {
425  return (this->direction & 1) ? speed : speed * 3 / 4;
426  }
427 
440  static inline uint GetAdvanceSpeed(uint speed)
441  {
442  return speed * 3 / 4;
443  }
444 
452  inline uint GetAdvanceDistance()
453  {
454  return (this->direction & 1) ? TILE_AXIAL_DISTANCE : TILE_CORNER_DISTANCE * 2;
455  }
456 
461  virtual ExpensesType GetExpenseType([[maybe_unused]] bool income) const { return EXPENSES_OTHER; }
462 
467  virtual void PlayLeaveStationSound([[maybe_unused]] bool force = false) const {}
468 
472  virtual bool IsPrimaryVehicle() const { return false; }
473 
474  const Engine *GetEngine() const;
475 
481  virtual void GetImage([[maybe_unused]] Direction direction, [[maybe_unused]] EngineImageType image_type, [[maybe_unused]] VehicleSpriteSeq *result) const { result->Clear(); }
482 
483  const GRFFile *GetGRF() const;
484  uint32_t GetGRFID() const;
485 
490  inline void InvalidateNewGRFCache()
491  {
492  this->grf_cache.cache_valid = 0;
493  }
494 
500  {
501  for (Vehicle *u = this; u != nullptr; u = u->Next()) {
502  u->InvalidateNewGRFCache();
503  }
504  }
505 
510  debug_inline bool IsGroundVehicle() const
511  {
512  return this->type == VEH_TRAIN || this->type == VEH_ROAD;
513  }
514 
519  virtual int GetDisplaySpeed() const { return 0; }
520 
525  virtual int GetDisplayMaxSpeed() const { return 0; }
526 
531  virtual int GetCurrentMaxSpeed() const { return 0; }
532 
537  virtual Money GetRunningCost() const { return 0; }
538 
543  virtual bool IsInDepot() const { return false; }
544 
549  virtual bool IsChainInDepot() const { return this->IsInDepot(); }
550 
555  bool IsStoppedInDepot() const
556  {
557  assert(this == this->First());
558  /* Free wagons have no VS_STOPPED state */
559  if (this->IsPrimaryVehicle() && !(this->vehstatus & VS_STOPPED)) return false;
560  return this->IsChainInDepot();
561  }
562 
567  virtual bool Tick() { return true; };
568 
572  virtual void OnNewCalendarDay() {};
573 
577  virtual void OnNewEconomyDay() {};
578 
579  void ShiftDates(TimerGameEconomy::Date interval);
580 
586  virtual uint Crash(bool flooded = false);
587 
600  virtual Trackdir GetVehicleTrackdir() const { return INVALID_TRACKDIR; }
601 
606  Money GetDisplayRunningCost() const { return (this->GetRunningCost() >> 8); }
607 
612  Money GetDisplayProfitThisYear() const { return (this->profit_this_year >> 8); }
613 
618  Money GetDisplayProfitLastYear() const { return (this->profit_last_year >> 8); }
619 
620  void SetNext(Vehicle *next);
621 
627  inline Vehicle *Next() const { return this->next; }
628 
634  inline Vehicle *Previous() const { return this->previous; }
635 
640  inline Vehicle *First() const { return this->first; }
641 
646  inline Vehicle *Last()
647  {
648  Vehicle *v = this;
649  while (v->Next() != nullptr) v = v->Next();
650  return v;
651  }
652 
657  inline const Vehicle *Last() const
658  {
659  const Vehicle *v = this;
660  while (v->Next() != nullptr) v = v->Next();
661  return v;
662  }
663 
669  inline Vehicle *Move(int n)
670  {
671  Vehicle *v = this;
672  if (n < 0) {
673  for (int i = 0; i != n && v != nullptr; i--) v = v->Previous();
674  } else {
675  for (int i = 0; i != n && v != nullptr; i++) v = v->Next();
676  }
677  return v;
678  }
679 
685  inline const Vehicle *Move(int n) const
686  {
687  const Vehicle *v = this;
688  if (n < 0) {
689  for (int i = 0; i != n && v != nullptr; i--) v = v->Previous();
690  } else {
691  for (int i = 0; i != n && v != nullptr; i++) v = v->Next();
692  }
693  return v;
694  }
695 
700  inline Order *GetFirstOrder() const { return (this->orders == nullptr) ? nullptr : this->orders->GetFirstOrder(); }
701 
702  void AddToShared(Vehicle *shared_chain);
703  void RemoveFromShared();
704 
709  inline Vehicle *NextShared() const { return this->next_shared; }
710 
715  inline Vehicle *PreviousShared() const { return this->previous_shared; }
716 
721  inline Vehicle *FirstShared() const { return (this->orders == nullptr) ? this->First() : this->orders->GetFirstSharedVehicle(); }
722 
727  inline bool IsOrderListShared() const { return this->orders != nullptr && this->orders->IsShared(); }
728 
733  inline VehicleOrderID GetNumOrders() const { return (this->orders == nullptr) ? 0 : this->orders->GetNumOrders(); }
734 
739  inline VehicleOrderID GetNumManualOrders() const { return (this->orders == nullptr) ? 0 : this->orders->GetNumManualOrders(); }
740 
746  {
747  return (this->orders == nullptr) ? INVALID_STATION : this->orders->GetNextStoppingStation(this);
748  }
749 
750  void ResetRefitCaps();
751 
758  inline void CopyVehicleConfigAndStatistics(const Vehicle *src)
759  {
760  this->CopyConsistPropertiesFrom(src);
761 
762  this->unitnumber = src->unitnumber;
763 
764  this->current_order = src->current_order;
765  this->dest_tile = src->dest_tile;
766 
767  this->profit_this_year = src->profit_this_year;
768  this->profit_last_year = src->profit_last_year;
769  }
770 
771 
772  bool HandleBreakdown();
773 
774  bool NeedsAutorenewing(const Company *c, bool use_renew_setting = true) const;
775 
776  bool NeedsServicing() const;
777  bool NeedsAutomaticServicing() const;
778 
786  virtual TileIndex GetOrderStationLocation([[maybe_unused]] StationID station) { return INVALID_TILE; }
787 
793  virtual ClosestDepot FindClosestDepot() { return {}; }
794 
795  virtual void SetDestTile(TileIndex tile) { this->dest_tile = tile; }
796 
798 
799  void UpdateVisualEffect(bool allow_power_change = true);
800  void ShowVisualEffect() const;
801 
802  void UpdatePosition();
803  void UpdateViewport(bool dirty);
804  void UpdateBoundingBoxCoordinates(bool update_cache) const;
806  bool MarkAllViewportsDirty() const;
807 
808  inline uint16_t GetServiceInterval() const { return this->service_interval; }
809 
810  inline void SetServiceInterval(uint16_t interval) { this->service_interval = interval; }
811 
812  inline bool ServiceIntervalIsCustom() const { return HasBit(this->vehicle_flags, VF_SERVINT_IS_CUSTOM); }
813 
814  inline bool ServiceIntervalIsPercent() const { return HasBit(this->vehicle_flags, VF_SERVINT_IS_PERCENT); }
815 
816  inline void SetServiceIntervalIsCustom(bool on) { SB(this->vehicle_flags, VF_SERVINT_IS_CUSTOM, 1, on); }
817 
818  inline void SetServiceIntervalIsPercent(bool on) { SB(this->vehicle_flags, VF_SERVINT_IS_PERCENT, 1, on); }
819 
820  bool HasUnbunchingOrder() const;
821  void LeaveUnbunchingDepot();
822  bool IsWaitingForUnbunching() const;
823 
824 private:
830  {
831  if (this->GetNumManualOrders() > 0) {
832  /* Advance to next real order */
833  do {
834  this->cur_real_order_index++;
835  if (this->cur_real_order_index >= this->GetNumOrders()) this->cur_real_order_index = 0;
836  } while (this->GetOrder(this->cur_real_order_index)->IsType(OT_IMPLICIT));
837  } else {
838  this->cur_real_order_index = 0;
839  }
840  }
841 
842 public:
849  {
850  if (this->cur_implicit_order_index == this->cur_real_order_index) {
851  /* Increment real order index as well */
852  this->SkipToNextRealOrderIndex();
853  }
854 
855  assert(this->cur_real_order_index == 0 || this->cur_real_order_index < this->GetNumOrders());
856 
857  /* Advance to next implicit order */
858  do {
859  this->cur_implicit_order_index++;
860  if (this->cur_implicit_order_index >= this->GetNumOrders()) this->cur_implicit_order_index = 0;
861  } while (this->cur_implicit_order_index != this->cur_real_order_index && !this->GetOrder(this->cur_implicit_order_index)->IsType(OT_IMPLICIT));
862 
863  InvalidateVehicleOrder(this, 0);
864  }
865 
873  {
874  if (this->cur_implicit_order_index == this->cur_real_order_index) {
875  /* Increment both real and implicit order */
877  } else {
878  /* Increment real order only */
879  this->SkipToNextRealOrderIndex();
880  InvalidateVehicleOrder(this, 0);
881  }
882  }
883 
888  {
889  /* Make sure the index is valid */
890  if (this->cur_real_order_index >= this->GetNumOrders()) this->cur_real_order_index = 0;
891 
892  if (this->GetNumManualOrders() > 0) {
893  /* Advance to next real order */
894  while (this->GetOrder(this->cur_real_order_index)->IsType(OT_IMPLICIT)) {
895  this->cur_real_order_index++;
896  if (this->cur_real_order_index >= this->GetNumOrders()) this->cur_real_order_index = 0;
897  }
898  } else {
899  this->cur_real_order_index = 0;
900  }
901  }
902 
908  inline Order *GetOrder(int index) const
909  {
910  return (this->orders == nullptr) ? nullptr : this->orders->GetOrderAt(index);
911  }
912 
917  inline Order *GetLastOrder() const
918  {
919  return (this->orders == nullptr) ? nullptr : this->orders->GetLastOrder();
920  }
921 
922  bool IsEngineCountable() const;
923  bool HasEngineType() const;
924  bool HasDepotOrder() const;
925  void HandlePathfindingResult(bool path_found);
926 
931  debug_inline bool IsFrontEngine() const
932  {
933  return this->IsGroundVehicle() && HasBit(this->subtype, GVSF_FRONT);
934  }
935 
940  inline bool IsArticulatedPart() const
941  {
942  return this->IsGroundVehicle() && HasBit(this->subtype, GVSF_ARTICULATED_PART);
943  }
944 
949  inline bool HasArticulatedPart() const
950  {
951  return this->Next() != nullptr && this->Next()->IsArticulatedPart();
952  }
953 
960  {
961  assert(this->HasArticulatedPart());
962  return this->Next();
963  }
964 
970  {
971  Vehicle *v = this;
972  while (v->IsArticulatedPart()) v = v->Previous();
973  return v;
974  }
975 
980  inline const Vehicle *GetFirstEnginePart() const
981  {
982  const Vehicle *v = this;
983  while (v->IsArticulatedPart()) v = v->Previous();
984  return v;
985  }
986 
992  {
993  Vehicle *v = this;
994  while (v->HasArticulatedPart()) v = v->GetNextArticulatedPart();
995  return v;
996  }
997 
1002  inline Vehicle *GetNextVehicle() const
1003  {
1004  const Vehicle *v = this;
1005  while (v->HasArticulatedPart()) v = v->GetNextArticulatedPart();
1006 
1007  /* v now contains the last articulated part in the engine */
1008  return v->Next();
1009  }
1010 
1015  inline Vehicle *GetPrevVehicle() const
1016  {
1017  Vehicle *v = this->Previous();
1018  while (v != nullptr && v->IsArticulatedPart()) v = v->Previous();
1019 
1020  return v;
1021  }
1022 
1027  struct OrderIterator {
1028  typedef Order value_type;
1029  typedef Order *pointer;
1030  typedef Order &reference;
1031  typedef size_t difference_type;
1032  typedef std::forward_iterator_tag iterator_category;
1033 
1034  explicit OrderIterator(OrderList *list) : list(list), prev(nullptr)
1035  {
1036  this->order = (this->list == nullptr) ? nullptr : this->list->GetFirstOrder();
1037  }
1038 
1039  bool operator==(const OrderIterator &other) const { return this->order == other.order; }
1040  bool operator!=(const OrderIterator &other) const { return !(*this == other); }
1041  Order * operator*() const { return this->order; }
1042  OrderIterator & operator++()
1043  {
1044  this->prev = (this->prev == nullptr) ? this->list->GetFirstOrder() : this->prev->next;
1045  this->order = (this->prev == nullptr) ? nullptr : this->prev->next;
1046  return *this;
1047  }
1048 
1049  private:
1050  OrderList *list;
1051  Order *order;
1052  Order *prev;
1053  };
1054 
1059  OrderList *list;
1060  IterateWrapper(OrderList *list = nullptr) : list(list) {}
1061  OrderIterator begin() { return OrderIterator(this->list); }
1062  OrderIterator end() { return OrderIterator(nullptr); }
1063  bool empty() { return this->begin() == this->end(); }
1064  };
1065 
1070  IterateWrapper Orders() const { return IterateWrapper(this->orders); }
1071 
1072  uint32_t GetDisplayMaxWeight() const;
1073  uint32_t GetDisplayMinPowerToWeight() const;
1074 };
1075 
1080 template <class T, VehicleType Type>
1081 struct SpecializedVehicle : public Vehicle {
1082  static const VehicleType EXPECTED_TYPE = Type;
1083 
1085 
1090  {
1091  this->sprite_cache.sprite_seq.count = 1;
1092  }
1093 
1098  inline T *First() const { return (T *)this->Vehicle::First(); }
1099 
1104  inline T *Last() { return (T *)this->Vehicle::Last(); }
1105 
1110  inline const T *Last() const { return (const T *)this->Vehicle::Last(); }
1111 
1116  inline T *Next() const { return (T *)this->Vehicle::Next(); }
1117 
1122  inline T *Previous() const { return (T *)this->Vehicle::Previous(); }
1123 
1129  inline T *GetNextArticulatedPart() { return (T *)this->Vehicle::GetNextArticulatedPart(); }
1130 
1136  inline T *GetNextArticulatedPart() const { return (T *)this->Vehicle::GetNextArticulatedPart(); }
1137 
1142  inline T *GetFirstEnginePart() { return (T *)this->Vehicle::GetFirstEnginePart(); }
1143 
1148  inline const T *GetFirstEnginePart() const { return (const T *)this->Vehicle::GetFirstEnginePart(); }
1149 
1154  inline T *GetLastEnginePart() { return (T *)this->Vehicle::GetLastEnginePart(); }
1155 
1160  inline T *GetNextVehicle() const { return (T *)this->Vehicle::GetNextVehicle(); }
1161 
1166  inline T *GetPrevVehicle() const { return (T *)this->Vehicle::GetPrevVehicle(); }
1167 
1173  static inline bool IsValidID(size_t index)
1174  {
1175  return Vehicle::IsValidID(index) && Vehicle::Get(index)->type == Type;
1176  }
1177 
1182  static inline T *Get(size_t index)
1183  {
1184  return (T *)Vehicle::Get(index);
1185  }
1186 
1191  static inline T *GetIfValid(size_t index)
1192  {
1193  return IsValidID(index) ? Get(index) : nullptr;
1194  }
1195 
1201  static inline T *From(Vehicle *v)
1202  {
1203  assert(v->type == Type);
1204  return (T *)v;
1205  }
1206 
1212  static inline const T *From(const Vehicle *v)
1213  {
1214  assert(v->type == Type);
1215  return (const T *)v;
1216  }
1217 
1223  inline void UpdateViewport(bool force_update, bool update_delta)
1224  {
1225  bool sprite_has_changed = false;
1226 
1227  /* Skip updating sprites on dedicated servers without screen */
1228  if (_network_dedicated) return;
1229 
1230  /* Explicitly choose method to call to prevent vtable dereference -
1231  * it gives ~3% runtime improvements in games with many vehicles */
1232  if (update_delta) ((T *)this)->T::UpdateDeltaXY();
1233 
1234  /*
1235  * Only check for a new sprite sequence if the vehicle direction
1236  * has changed since we last checked it, assuming that otherwise
1237  * there won't be enough change in bounding box or offsets to need
1238  * to resolve a new sprite.
1239  */
1240  if (this->direction != this->sprite_cache.last_direction || this->sprite_cache.is_viewport_candidate) {
1241  VehicleSpriteSeq seq;
1242 
1243  ((T*)this)->T::GetImage(this->direction, EIT_ON_MAP, &seq);
1244  if (this->sprite_cache.sprite_seq != seq) {
1245  sprite_has_changed = true;
1246  this->sprite_cache.sprite_seq = seq;
1247  }
1248 
1249  this->sprite_cache.last_direction = this->direction;
1250  this->sprite_cache.revalidate_before_draw = false;
1251  } else {
1252  /*
1253  * A change that could potentially invalidate the sprite has been
1254  * made, signal that we should still resolve it before drawing on a
1255  * viewport.
1256  */
1257  this->sprite_cache.revalidate_before_draw = true;
1258  }
1259 
1260  if (force_update || sprite_has_changed) {
1261  this->Vehicle::UpdateViewport(true);
1262  }
1263  }
1264 
1270  static Pool::IterateWrapper<T> Iterate(size_t from = 0) { return Pool::IterateWrapper<T>(from); }
1271 };
1272 
1275  bool *cache;
1278 
1280  UnitID NextID();
1281 
1283  ~FreeUnitIDGenerator() { free(this->cache); }
1284 };
1285 
1287 static const int32_t INVALID_COORD = 0x7fffffff;
1288 
1289 #endif /* VEHICLE_BASE_H */
SpecializedVehicle::GetNextVehicle
T * GetNextVehicle() const
Get the next real (non-articulated part) vehicle in the consist.
Definition: vehicle_base.h:1160
GVSF_ENGINE
@ GVSF_ENGINE
Engine that can be front engine, but might be placed behind another engine (not used for road vehicle...
Definition: vehicle_base.h:117
Vehicle::GetGroundVehicleCache
GroundVehicleCache * GetGroundVehicleCache()
Access the ground vehicle cache of the vehicle.
Definition: vehicle.cpp:3080
Vehicle::IsChainInDepot
virtual bool IsChainInDepot() const
Check whether the whole vehicle chain is in the depot.
Definition: vehicle_base.h:549
Vehicle::IsFrontEngine
debug_inline bool IsFrontEngine() const
Check if the vehicle is a front engine.
Definition: vehicle_base.h:931
BaseConsist::cur_implicit_order_index
VehicleOrderID cur_implicit_order_index
The index to the current implicit order.
Definition: base_consist.h:32
Vehicle::x_bb_offs
int8_t x_bb_offs
x offset of vehicle bounding box
Definition: vehicle_base.h:314
Vehicle::SkipToNextRealOrderIndex
void SkipToNextRealOrderIndex()
Advance cur_real_order_index to the next real order.
Definition: vehicle_base.h:829
VehicleOrderID
byte VehicleOrderID
The index of an order within its current vehicle (not pool related)
Definition: order_type.h:15
MutableSpriteCache::is_viewport_candidate
bool is_viewport_candidate
This vehicle can potentially be drawn on a viewport.
Definition: vehicle_base.h:195
transport_type.h
LoadgameState
Definition: oldloader.h:19
SmallStack
Minimal stack that uses a pool to avoid pointers.
Definition: smallstack_type.hpp:135
MutableSpriteCache::last_direction
Direction last_direction
Last direction we obtained sprites for.
Definition: vehicle_base.h:192
VE_OFFSET_COUNT
@ VE_OFFSET_COUNT
Number of bits used for the offset.
Definition: vehicle_base.h:81
VehicleCache::cached_cargo_age_period
uint16_t cached_cargo_age_period
Number of ticks before carried cargo is aged.
Definition: vehicle_base.h:125
VE_DISABLE_EFFECT
@ VE_DISABLE_EFFECT
Flag to disable visual effect.
Definition: vehicle_base.h:91
Vehicle::PreDestructor
void PreDestructor()
Destroy all stuff that (still) needs the virtual functions to work properly.
Definition: vehicle.cpp:826
UnitID
uint16_t UnitID
Type for the company global vehicle unit number.
Definition: transport_type.h:16
Pool::PoolItem<&_vehicle_pool >::Get
static Titem * Get(size_t index)
Returns Titem with given index.
Definition: pool_type.hpp:335
Direction
Direction
Defines the 8 directions on the map.
Definition: direction_type.h:24
SpecializedVehicle::SpecializedVehicleBase
SpecializedVehicle< T, Type > SpecializedVehicleBase
Our type.
Definition: vehicle_base.h:1084
MutableSpriteCache::sprite_seq
VehicleSpriteSeq sprite_seq
Vehicle appearance.
Definition: vehicle_base.h:196
VehicleSpriteSeq::CopyWithoutPalette
void CopyWithoutPalette(const VehicleSpriteSeq &src)
Copy data from another sprite sequence, while dropping all recolouring information.
Definition: vehicle_base.h:174
Vehicle::PreviousShared
Vehicle * PreviousShared() const
Get the previous vehicle of the shared vehicle chain.
Definition: vehicle_base.h:715
Vehicle::GetNumManualOrders
VehicleOrderID GetNumManualOrders() const
Get the number of manually added orders this vehicle has.
Definition: vehicle_base.h:739
Vehicle::reliability_spd_dec
uint16_t reliability_spd_dec
Reliability decrease speed.
Definition: vehicle_base.h:293
Vehicle::GetRunningCost
virtual Money GetRunningCost() const
Gets the running cost of a vehicle.
Definition: vehicle_base.h:537
Vehicle::value
Money value
Value of the vehicle.
Definition: vehicle_base.h:271
_vehicle_pool
VehiclePool _vehicle_pool
The pool with all our precious vehicles.
Vehicle::HasEngineType
bool HasEngineType() const
Check whether Vehicle::engine_type has any meaning.
Definition: vehicle.cpp:731
mem_func.hpp
Vehicle::IsEngineCountable
bool IsEngineCountable() const
Check if a vehicle is counted in num_engines in each company struct.
Definition: vehicle.cpp:714
Vehicle::cargo_cap
uint16_t cargo_cap
total capacity
Definition: vehicle_base.h:338
INVALID_COORD
static const int32_t INVALID_COORD
Sentinel for an invalid coordinate.
Definition: vehicle_base.h:1287
Vehicle::Previous
Vehicle * Previous() const
Get the previous vehicle of this vehicle.
Definition: vehicle_base.h:634
Vehicle::GetNextVehicle
Vehicle * GetNextVehicle() const
Get the next real (non-articulated part) vehicle in the consist.
Definition: vehicle_base.h:1002
Vehicle::UpdateDeltaXY
virtual void UpdateDeltaXY()
Updates the x and y offsets and the size of the sprite used for this vehicle.
Definition: vehicle_base.h:408
Vehicle::LeaveStation
void LeaveStation()
Perform all actions when leaving a station.
Definition: vehicle.cpp:2321
Vehicle::Next
Vehicle * Next() const
Get the next vehicle of this vehicle.
Definition: vehicle_base.h:627
SpecializedVehicle::Next
T * Next() const
Get next vehicle in the chain.
Definition: vehicle_base.h:1116
EXPENSES_OTHER
@ EXPENSES_OTHER
Other expenses.
Definition: economy_type.h:185
timer_game_calendar.h
BaseConsist::service_interval
uint16_t service_interval
The interval for (automatic) servicing; either in days or %.
Definition: base_consist.h:29
Vehicle::GetDisplayMaxSpeed
virtual int GetDisplayMaxSpeed() const
Gets the maximum speed in km-ish/h that can be sent into SetDParam for string processing.
Definition: vehicle_base.h:525
Vehicle::y_extent
byte y_extent
y-extent of vehicle bounding box
Definition: vehicle_base.h:312
Station
Station data structure.
Definition: station_base.h:442
Vehicle::NeedsAutomaticServicing
bool NeedsAutomaticServicing() const
Checks if the current order should be interrupted for a service-in-depot order.
Definition: vehicle.cpp:272
Vehicle::GetLastEnginePart
Vehicle * GetLastEnginePart()
Get the last part of an articulated engine.
Definition: vehicle_base.h:991
VehicleSpriteSeq::Clear
void Clear()
Clear all information.
Definition: vehicle_base.h:156
VehicleSpriteSeq::Set
void Set(SpriteID sprite)
Assign a single sprite to the sequence.
Definition: vehicle_base.h:164
FreeUnitIDGenerator::curid
UnitID curid
last ID returned; 0 if none
Definition: vehicle_base.h:1277
Vehicle::old_orders
Order * old_orders
Only used during conversion of old save games.
Definition: vehicle_base.h:353
Vehicle::vehstatus
byte vehstatus
Status.
Definition: vehicle_base.h:348
VE_DEFAULT
@ VE_DEFAULT
Default value to indicate that visual effect should be based on engine class.
Definition: vehicle_base.h:95
Vehicle::grf_cache
NewGRFCache grf_cache
Cache of often used calculated NewGRF values.
Definition: vehicle_base.h:360
VS_DEFPAL
@ VS_DEFPAL
Use default vehicle palette.
Definition: vehicle_base.h:36
Pool::PoolItem<&_vehicle_pool >::index
Tindex index
Index of this pool item.
Definition: pool_type.hpp:234
Vehicle::SetNext
void SetNext(Vehicle *next)
Set the next vehicle of this vehicle.
Definition: vehicle.cpp:2862
order_base.h
Vehicle::GetGRFID
uint32_t GetGRFID() const
Retrieve the GRF ID of the NewGRF the vehicle is tied to.
Definition: vehicle.cpp:767
Vehicle::Crash
virtual uint Crash(bool flooded=false)
Crash the (whole) vehicle chain.
Definition: vehicle.cpp:280
Vehicle::acceleration
byte acceleration
used by train & aircraft
Definition: vehicle_base.h:325
PalSpriteID::sprite
SpriteID sprite
The 'real' sprite.
Definition: gfx_type.h:23
Vehicle::group_id
GroupID group_id
Index of group Pool array.
Definition: vehicle_base.h:357
Vehicle::Vehicle
Vehicle(VehicleType type=VEH_INVALID)
Vehicle constructor.
Definition: vehicle.cpp:361
INVALID_TILE
constexpr TileIndex INVALID_TILE
The very nice invalid tile marker.
Definition: tile_type.h:95
GroundVehicleSubtypeFlags
GroundVehicleSubtypeFlags
Enum to handle ground vehicle subtypes.
Definition: vehicle_base.h:113
BaseConsist::vehicle_flags
uint16_t vehicle_flags
Used for gradual loading and other miscellaneous things (.
Definition: base_consist.h:34
Vehicle::GetMaxWeight
virtual uint16_t GetMaxWeight() const
Calculates the weight value that this vehicle will have when fully loaded with its current cargo.
Definition: vehicle_base.h:369
Vehicle::trip_occupancy
int8_t trip_occupancy
NOSAVE: Occupancy of vehicle of the current trip (updated after leaving a station).
Definition: vehicle_base.h:342
VE_TYPE_ELECTRIC
@ VE_TYPE_ELECTRIC
Electric sparks.
Definition: vehicle_base.h:89
Vehicle::next
Vehicle * next
pointer to the next vehicle in the chain
Definition: vehicle_base.h:244
Vehicle::GetGRF
const GRFFile * GetGRF() const
Retrieve the NewGRF the vehicle is tied to.
Definition: vehicle.cpp:757
Vehicle::last_loading_tick
TimerGameTick::TickCounter last_loading_tick
Last TimerGameTick::counter tick that the vehicle has stopped at a station and could possibly leave w...
Definition: vehicle_base.h:334
VF_LOADING_FINISHED
@ VF_LOADING_FINISHED
Vehicle has finished loading.
Definition: vehicle_base.h:45
saveload.h
SpecializedVehicle::GetNextArticulatedPart
T * GetNextArticulatedPart()
Get the next part of an articulated engine.
Definition: vehicle_base.h:1129
Vehicle::running_ticks
byte running_ticks
Number of ticks this vehicle was not stopped this day.
Definition: vehicle_base.h:346
Vehicle::~Vehicle
virtual ~Vehicle()
We want to 'destruct' the right class.
Definition: vehicle.cpp:891
base_consist.h
VE_TYPE_COUNT
@ VE_TYPE_COUNT
Number of bits used for the effect type.
Definition: vehicle_base.h:85
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
NewGRFCache::position_in_vehicle
uint32_t position_in_vehicle
Cache for NewGRF var 4D.
Definition: vehicle_base.h:74
VS_TRAIN_SLOWING
@ VS_TRAIN_SLOWING
Train is slowing down.
Definition: vehicle_base.h:37
Vehicle::OrderIterator
Iterator to iterate orders Supports deletion of current order.
Definition: vehicle_base.h:1027
Vehicle::GetNextArticulatedPart
Vehicle * GetNextArticulatedPart() const
Get the next part of an articulated engine.
Definition: vehicle_base.h:959
Vehicle::AfterLoadVehicles
friend void AfterLoadVehicles(bool part_of_load)
So we can set the previous and first pointers while loading.
Definition: vehicle_sl.cpp:255
EngineImageType
EngineImageType
Visualisation contexts of vehicles and engines.
Definition: vehicle_type.h:85
Engine
Definition: engine_base.h:37
Vehicle::FindClosestDepot
virtual ClosestDepot FindClosestDepot()
Find the closest depot for this vehicle and tell us the location, DestinationID and whether we should...
Definition: vehicle_base.h:793
VEH_ROAD
@ VEH_ROAD
Road vehicle type.
Definition: vehicle_type.h:25
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:240
Vehicle::IsPrimaryVehicle
virtual bool IsPrimaryVehicle() const
Whether this is the primary vehicle in the chain.
Definition: vehicle_base.h:472
OrderList::IsShared
bool IsShared() const
Is this a shared order list?
Definition: order_base.h:339
VehicleSpriteSeq::Draw
void Draw(int x, int y, PaletteID default_pal, bool force_pal) const
Draw the sprite sequence.
Definition: vehicle.cpp:131
Vehicle::owner
Owner owner
Which company owns the vehicle?
Definition: vehicle_base.h:304
Owner
Owner
Enum for all companies/owners.
Definition: company_type.h:18
TimerGameTick::TickCounter
uint64_t TickCounter
The type that the tick counter is stored in.
Definition: timer_game_tick.h:25
Vehicle::IsInDepot
virtual bool IsInDepot() const
Check whether the vehicle is in the depot.
Definition: vehicle_base.h:543
PaletteID
uint32_t PaletteID
The number of the palette.
Definition: gfx_type.h:18
Vehicle::IsGroundVehicle
debug_inline bool IsGroundVehicle() const
Check if the vehicle is a ground vehicle.
Definition: vehicle_base.h:510
VS_AIRCRAFT_BROKEN
@ VS_AIRCRAFT_BROKEN
Aircraft is broken down.
Definition: vehicle_base.h:39
Vehicle::motion_counter
uint32_t motion_counter
counter to occasionally play a vehicle sound.
Definition: vehicle_base.h:326
DoCommandFlag
DoCommandFlag
List of flags for a command.
Definition: command_type.h:369
VE_OFFSET_START
@ VE_OFFSET_START
First bit that contains the offset (0 = front, 8 = centre, 15 = rear)
Definition: vehicle_base.h:80
Vehicle::breakdowns_since_last_service
byte breakdowns_since_last_service
Counter for the amount of breakdowns.
Definition: vehicle_base.h:296
Vehicle::UpdateRealOrderIndex
void UpdateRealOrderIndex()
Skip implicit orders until cur_real_order_index is a non-implicit order.
Definition: vehicle_base.h:887
NCVV_POSITION_IN_VEHICLE
@ NCVV_POSITION_IN_VEHICLE
This bit will be set if the NewGRF var 4D currently stored is valid.
Definition: vehicle_base.h:63
Vehicle::x_pos
int32_t x_pos
x coordinate.
Definition: vehicle_base.h:299
Vehicle::IsArticulatedPart
bool IsArticulatedPart() const
Check if the vehicle is an articulated part of an engine.
Definition: vehicle_base.h:940
VehicleCargoList
CargoList that is used for vehicles.
Definition: cargopacket.h:351
VF_STOP_LOADING
@ VF_STOP_LOADING
Don't load anymore during the next load cycle.
Definition: vehicle_base.h:51
SlVehicleCommon
Definition: vehicle_sl.cpp:606
VE_TYPE_DIESEL
@ VE_TYPE_DIESEL
Diesel fumes.
Definition: vehicle_base.h:88
Vehicle::date_of_last_service
TimerGameEconomy::Date date_of_last_service
Last economy date the vehicle had a service at a depot.
Definition: vehicle_base.h:290
Vehicle::GetImage
virtual void GetImage([[maybe_unused]] Direction direction, [[maybe_unused]] EngineImageType image_type, [[maybe_unused]] VehicleSpriteSeq *result) const
Gets the sprite to show for the given direction.
Definition: vehicle_base.h:481
VESM_STEAM
@ VESM_STEAM
Steam model.
Definition: vehicle_base.h:101
Vehicle::GetDisplayRunningCost
Money GetDisplayRunningCost() const
Gets the running cost of a vehicle that can be sent into SetDParam for string processing.
Definition: vehicle_base.h:606
VehicleCache::cached_max_speed
uint16_t cached_max_speed
Maximum speed of the consist (minimum of the max speed of all vehicles in the consist).
Definition: vehicle_base.h:124
VF_AUTOFILL_TIMETABLE
@ VF_AUTOFILL_TIMETABLE
Whether the vehicle should fill in the timetable automatically.
Definition: vehicle_base.h:49
MutableSpriteCache
Cache for vehicle sprites and values relating to whether they should be updated before drawing,...
Definition: vehicle_base.h:191
Vehicle::Orders
IterateWrapper Orders() const
Returns an iterable ensemble of orders of a vehicle.
Definition: vehicle_base.h:1070
Vehicle::Last
const Vehicle * Last() const
Get the last vehicle of this vehicle chain.
Definition: vehicle_base.h:657
Vehicle::BeginLoading
void BeginLoading()
Prepare everything to begin the loading when arriving at a station.
Definition: vehicle.cpp:2174
NewGRFCache::position_consist_length
uint32_t position_consist_length
Cache for NewGRF var 40.
Definition: vehicle_base.h:70
Vehicle::breakdown_ctr
byte breakdown_ctr
Counter for managing breakdown events.
Definition: vehicle_base.h:294
VS_HIDDEN
@ VS_HIDDEN
Vehicle is not visible.
Definition: vehicle_base.h:33
Vehicle::UpdateVisualEffect
void UpdateVisualEffect(bool allow_power_change=true)
Update the cached visual effect.
Definition: vehicle.cpp:2589
DepotCommand
DepotCommand
Flags for goto depot commands.
Definition: vehicle_type.h:64
VehicleSpriteSeq::IsValid
bool IsValid() const
Check whether the sequence contains any sprites.
Definition: vehicle_base.h:148
Vehicle::dest_tile
TileIndex dest_tile
Heading for this tile.
Definition: vehicle_base.h:267
Vehicle::HandlePathfindingResult
void HandlePathfindingResult(bool path_found)
Handle the pathfinding result, especially the lost status.
Definition: vehicle.cpp:791
Vehicle::GetDisplayProfitThisYear
Money GetDisplayProfitThisYear() const
Gets the profit vehicle had this year.
Definition: vehicle_base.h:612
Vehicle::GetDisplaySpeed
virtual int GetDisplaySpeed() const
Gets the speed in km-ish/h that can be sent into SetDParam for string processing.
Definition: vehicle_base.h:519
Vehicle::GetPrevVehicle
Vehicle * GetPrevVehicle() const
Get the previous real (non-articulated part) vehicle in the consist.
Definition: vehicle_base.h:1015
VE_TYPE_START
@ VE_TYPE_START
First bit used for the type of effect.
Definition: vehicle_base.h:84
GroundVehicleCache
Cached, frequently calculated values.
Definition: ground_vehicle.hpp:29
CommandCost
Common return value for all commands.
Definition: command_type.h:23
OrderList::GetNumManualOrders
VehicleOrderID GetNumManualOrders() const
Get number of manually added orders in the order list.
Definition: order_base.h:326
Vehicle::UpdateBoundingBoxCoordinates
void UpdateBoundingBoxCoordinates(bool update_cache) const
Update the bounding box co-ordinates of the vehicle.
Definition: vehicle.cpp:1677
BaseVehicle
Base vehicle class.
Definition: vehicle_type.h:49
Vehicle::GetCurrentMaxSpeed
virtual int GetCurrentMaxSpeed() const
Calculates the maximum speed of the vehicle under its current conditions.
Definition: vehicle_base.h:531
FreeUnitIDGenerator::NextID
UnitID NextID()
Returns next free UnitID.
Definition: vehicle.cpp:1850
Vehicle::AddToShared
void AddToShared(Vehicle *shared_chain)
Adds this vehicle to a shared vehicle chain.
Definition: vehicle.cpp:2891
VehStatus
VehStatus
Vehicle status bits in Vehicle::vehstatus.
Definition: vehicle_base.h:32
Vehicle::IsWaitingForUnbunching
bool IsWaitingForUnbunching() const
Check whether a vehicle inside a depot is waiting for unbunching.
Definition: vehicle.cpp:2481
Vehicle::RemoveFromShared
void RemoveFromShared()
Removes the vehicle from the shared order list.
Definition: vehicle.cpp:2914
VF_CARGO_UNLOADING
@ VF_CARGO_UNLOADING
Vehicle is unloading cargo.
Definition: vehicle_base.h:46
NCVV_POSITION_CONSIST_LENGTH
@ NCVV_POSITION_CONSIST_LENGTH
This bit will be set if the NewGRF var 40 currently stored is valid.
Definition: vehicle_base.h:59
Vehicle::tile
TileIndex tile
Current tile index.
Definition: vehicle_base.h:260
Vehicle::CancelReservation
void CancelReservation(StationID next, Station *st)
Return all reserved cargo packets to the station and reset all packets staged for transfer.
Definition: vehicle.cpp:2305
free
void free(const void *ptr)
Version of the standard free that accepts const pointers.
Definition: stdafx.h:379
EIT_ON_MAP
@ EIT_ON_MAP
Vehicle drawn in viewport.
Definition: vehicle_type.h:86
Vehicle::random_bits
uint16_t random_bits
Bits used for randomized variational spritegroups.
Definition: vehicle_base.h:329
Vehicle::engine_type
EngineID engine_type
The type of engine used for this vehicle.
Definition: vehicle_base.h:318
VS_CRASHED
@ VS_CRASHED
Vehicle is crashed.
Definition: vehicle_base.h:40
VehicleSpriteSeq
Sprite sequence for a vehicle part.
Definition: vehicle_base.h:131
LoadOldVehicle
bool LoadOldVehicle(LoadgameState *ls, int num)
Load the vehicles of an old style savegame.
Definition: oldloader_sl.cpp:1241
OrderList::GetFirstSharedVehicle
Vehicle * GetFirstSharedVehicle() const
Get the first vehicle of this vehicle chain.
Definition: order_base.h:345
Vehicle::last_station_visited
StationID last_station_visited
The last station we stopped at.
Definition: vehicle_base.h:332
Vehicle::GetVehicleTrackdir
virtual Trackdir GetVehicleTrackdir() const
Returns the Trackdir on which the vehicle is currently located.
Definition: vehicle_base.h:600
CargoPayment
Helper class to perform the cargo payment.
Definition: economy_base.h:24
Vehicle::cargo
VehicleCargoList cargo
The cargo this vehicle is carrying.
Definition: vehicle_base.h:340
Vehicle::GetOldAdvanceSpeed
uint GetOldAdvanceSpeed(uint speed)
Determines the effective direction-specific vehicle movement speed.
Definition: vehicle_base.h:423
RefitDesc::remaining
uint16_t remaining
Capacity remaining from before the previous refit.
Definition: vehicle_base.h:217
VehicleFlags
VehicleFlags
Bit numbers in Vehicle::vehicle_flags.
Definition: vehicle_base.h:44
SpecializedVehicle
Class defining several overloaded accessors so we don't have to cast vehicle types that often.
Definition: vehicle_base.h:1081
Vehicle::hash_tile_current
Vehicle ** hash_tile_current
NOSAVE: Cache of the current hash chain.
Definition: vehicle_base.h:282
GVSF_ARTICULATED_PART
@ GVSF_ARTICULATED_PART
Articulated part of an engine.
Definition: vehicle_base.h:115
Vehicle::current_order
Order current_order
The current order (+ status, like: loading)
Definition: vehicle_base.h:349
FreeUnitIDGenerator::~FreeUnitIDGenerator
~FreeUnitIDGenerator()
Releases allocated memory.
Definition: vehicle_base.h:1283
NewGRFCache::consist_cargo_information
uint32_t consist_cargo_information
Cache for NewGRF var 42. (Note: The cargotype is untranslated in the cache because the accessing GRF ...
Definition: vehicle_base.h:72
Vehicle::GetExpenseType
virtual ExpensesType GetExpenseType([[maybe_unused]] bool income) const
Sets the expense type associated to this vehicle type.
Definition: vehicle_base.h:461
Vehicle::cur_speed
uint16_t cur_speed
current speed
Definition: vehicle_base.h:323
Vehicle::GetLastOrder
Order * GetLastOrder() const
Returns the last order of a vehicle, or nullptr if it doesn't exists.
Definition: vehicle_base.h:917
FreeUnitIDGenerator
Generates sequence of free UnitID numbers.
Definition: vehicle_base.h:1274
Vehicle::build_year
TimerGameCalendar::Year build_year
Year the vehicle has been built.
Definition: vehicle_base.h:287
SpecializedVehicle::Get
static T * Get(size_t index)
Gets vehicle with given index.
Definition: vehicle_base.h:1182
Pool::IterateWrapper
Definition: pool_type.hpp:174
VS_STOPPED
@ VS_STOPPED
Vehicle is stopped by the player.
Definition: vehicle_base.h:34
VehicleCache
Cached often queried values common to all vehicles.
Definition: vehicle_base.h:123
Vehicle::ShowVisualEffect
void ShowVisualEffect() const
Draw visual effects (smoke and/or sparks) for a vehicle chain.
Definition: vehicle.cpp:2712
Vehicle::GetEngine
const Engine * GetEngine() const
Retrieves the engine of the vehicle.
Definition: vehicle.cpp:747
VisualEffectSpawnModel
VisualEffectSpawnModel
Models for spawning visual effects.
Definition: vehicle_base.h:99
Vehicle::CopyVehicleConfigAndStatistics
void CopyVehicleConfigAndStatistics(const Vehicle *src)
Copy certain configurations and statistics of a vehicle after successful autoreplace/renew The functi...
Definition: vehicle_base.h:758
cargopacket.h
Vehicle::ResetRefitCaps
void ResetRefitCaps()
Reset all refit_cap in the consist to cargo_cap.
Definition: vehicle.cpp:2382
Vehicle::UpdateViewport
void UpdateViewport(bool dirty)
Update the vehicle on the viewport, updating the right hash and setting the new coordinates.
Definition: vehicle.cpp:1710
Vehicle::last_loading_station
StationID last_loading_station
Last station the vehicle has stopped at and could possibly leave from with any cargo loaded.
Definition: vehicle_base.h:333
VEH_INVALID
@ VEH_INVALID
Non-existing type of vehicle.
Definition: vehicle_type.h:35
VF_SERVINT_IS_CUSTOM
@ VF_SERVINT_IS_CUSTOM
Service interval is custom.
Definition: vehicle_base.h:53
Vehicle::previous_shared
Vehicle * previous_shared
NOSAVE: pointer to the previous vehicle in the shared order chain.
Definition: vehicle_base.h:249
Vehicle::profit_this_year
Money profit_this_year
Profit this year << 8, low 8 bits are fract.
Definition: vehicle_base.h:269
Vehicle::PlayLeaveStationSound
virtual void PlayLeaveStationSound([[maybe_unused]] bool force=false) const
Play the sound associated with leaving the station.
Definition: vehicle_base.h:467
Vehicle::y_bb_offs
int8_t y_bb_offs
y offset of vehicle bounding box
Definition: vehicle_base.h:315
VehiclePool
Pool< Vehicle, VehicleID, 512, 0xFF000 > VehiclePool
A vehicle pool for a little over 1 million vehicles.
Definition: vehicle_base.h:200
Vehicle::MarkAllViewportsDirty
bool MarkAllViewportsDirty() const
Marks viewports dirty where the vehicle's image is.
Definition: vehicle.cpp:1749
Vehicle::OnNewEconomyDay
virtual void OnNewEconomyDay()
Calls the new economy day handler of the vehicle.
Definition: vehicle_base.h:577
GVSF_WAGON
@ GVSF_WAGON
Wagon (not used for road vehicles).
Definition: vehicle_base.h:116
INVALID_TRACKDIR
@ INVALID_TRACKDIR
Flag for an invalid trackdir.
Definition: track_type.h:86
FixOldVehicles
void FixOldVehicles()
Convert the old style vehicles into something that resembles the old new style savegames.
Definition: oldloader_sl.cpp:163
VehicleCache::cached_vis_effect
byte cached_vis_effect
Visual effect to show (see VisualEffect)
Definition: vehicle_base.h:127
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
Vehicle::HandleLoading
void HandleLoading(bool mode=false)
Handle the loading of the vehicle; when not it skips through dummy orders and does nothing in all oth...
Definition: vehicle.cpp:2392
Vehicle::HasDepotOrder
bool HasDepotOrder() const
Checks if a vehicle has a depot in its order list.
Definition: order_cmd.cpp:1851
Vehicle::cargo_age_counter
uint16_t cargo_age_counter
Ticks till cargo is aged next.
Definition: vehicle_base.h:341
_network_dedicated
bool _network_dedicated
are we a dedicated server?
Definition: network.cpp:62
Vehicle::Move
const Vehicle * Move(int n) const
Get the vehicle at offset n of this vehicle chain.
Definition: vehicle_base.h:685
OrderList::GetNextStoppingStation
StationIDStack GetNextStoppingStation(const Vehicle *v, const Order *first=nullptr, uint hops=0) const
Recursively determine the next deterministic station to stop at.
Definition: order_cmd.cpp:415
VisualEffect
VisualEffect
Meaning of the various bits of the visual effect.
Definition: vehicle_base.h:79
Vehicle::SendToDepot
CommandCost SendToDepot(DoCommandFlag flags, DepotCommand command)
Send this vehicle to the depot using the given command(s).
Definition: vehicle.cpp:2508
VehicleType
VehicleType
Available vehicle types.
Definition: vehicle_type.h:21
Vehicle::sprite_cache
MutableSpriteCache sprite_cache
Cache of sprites and values related to recalculating them, see MutableSpriteCache.
Definition: vehicle_base.h:363
SpriteID
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
Definition: gfx_type.h:17
Vehicle::IsOrderListShared
bool IsOrderListShared() const
Check if we share our orders with another vehicle.
Definition: vehicle_base.h:727
VE_TYPE_DEFAULT
@ VE_TYPE_DEFAULT
Use default from engine class.
Definition: vehicle_base.h:86
Vehicle::colourmap
SpriteID colourmap
NOSAVE: cached colour mapping.
Definition: vehicle_base.h:284
Vehicle::waiting_triggers
byte waiting_triggers
Triggers to be yet matched before rerandomizing the random bits.
Definition: vehicle_base.h:330
OrderList::GetOrderAt
Order * GetOrderAt(int index) const
Get a certain order of the order chain.
Definition: order_cmd.cpp:357
VESM_DIESEL
@ VESM_DIESEL
Diesel model.
Definition: vehicle_base.h:102
Vehicle::IncrementRealOrderIndex
void IncrementRealOrderIndex()
Advanced cur_real_order_index to the next real order, keeps care of the wrap-around and invalidates t...
Definition: vehicle_base.h:872
Vehicle::z_pos
int32_t z_pos
z coordinate.
Definition: vehicle_base.h:301
VF_BUILT_AS_PROTOTYPE
@ VF_BUILT_AS_PROTOTYPE
Vehicle is a prototype (accepted as exclusive preview).
Definition: vehicle_base.h:47
command_type.h
Vehicle::IterateWrapper
Iterable ensemble of orders.
Definition: vehicle_base.h:1058
Vehicle::direction
Direction direction
facing
Definition: vehicle_base.h:302
FreeUnitIDGenerator::cache
bool * cache
array of occupied unit id numbers
Definition: vehicle_base.h:1275
SpecializedVehicle::EXPECTED_TYPE
static const VehicleType EXPECTED_TYPE
Specialized type.
Definition: vehicle_base.h:1082
BaseConsist::cur_real_order_index
VehicleOrderID cur_real_order_index
The index to the current real (non-implicit) order.
Definition: base_consist.h:31
Vehicle::next_shared
Vehicle * next_shared
pointer to the next vehicle that shares the order
Definition: vehicle_base.h:248
texteff.hpp
Vehicle::load_unload_ticks
uint16_t load_unload_ticks
Ticks to wait before starting next cycle.
Definition: vehicle_base.h:356
Vehicle::FirstShared
Vehicle * FirstShared() const
Get the first vehicle of this vehicle chain.
Definition: vehicle_base.h:721
Vehicle::x_extent
byte x_extent
x-extent of vehicle bounding box
Definition: vehicle_base.h:311
Vehicle::Move
Vehicle * Move(int n)
Get the vehicle at offset n of this vehicle chain.
Definition: vehicle_base.h:669
NCVV_CONSIST_CARGO_INFORMATION
@ NCVV_CONSIST_CARGO_INFORMATION
This bit will be set if the NewGRF var 42 currently stored is valid.
Definition: vehicle_base.h:61
Vehicle::GetFirstEnginePart
const Vehicle * GetFirstEnginePart() const
Get the first part of an articulated engine.
Definition: vehicle_base.h:980
Vehicle::vcache
VehicleCache vcache
Cache of often used vehicle values.
Definition: vehicle_base.h:361
NewGRFCache::position_same_id_length
uint32_t position_same_id_length
Cache for NewGRF var 41.
Definition: vehicle_base.h:71
GVSF_FREE_WAGON
@ GVSF_FREE_WAGON
First in a wagon chain (in depot) (not used for road vehicles).
Definition: vehicle_base.h:118
VESM_NONE
@ VESM_NONE
No visual effect.
Definition: vehicle_base.h:100
MutableSpriteCache::revalidate_before_draw
bool revalidate_before_draw
We need to do a GetImage() and check bounds before drawing this sprite.
Definition: vehicle_base.h:193
Vehicle::hash_viewport_next
Vehicle * hash_viewport_next
NOSAVE: Next vehicle in the visual location hash.
Definition: vehicle_base.h:277
Pool
Base class for all pools.
Definition: pool_type.hpp:80
Vehicle::First
Vehicle * First() const
Get the first vehicle of this vehicle chain.
Definition: vehicle_base.h:640
Vehicle::max_age
TimerGameCalendar::Date max_age
Maximum age.
Definition: vehicle_base.h:289
Vehicle::tick_counter
byte tick_counter
Increased by one for each tick.
Definition: vehicle_base.h:345
engine_type.h
Vehicle::IncrementImplicitOrderIndex
void IncrementImplicitOrderIndex()
Increments cur_implicit_order_index, keeps care of the wrap-around and invalidates the GUI.
Definition: vehicle_base.h:848
NCVV_POSITION_SAME_ID_LENGTH
@ NCVV_POSITION_SAME_ID_LENGTH
This bit will be set if the NewGRF var 41 currently stored is valid.
Definition: vehicle_base.h:60
Vehicle::subspeed
byte subspeed
fractional speed
Definition: vehicle_base.h:324
Vehicle::GetAdvanceSpeed
static uint GetAdvanceSpeed(uint speed)
Determines the effective vehicle movement speed.
Definition: vehicle_base.h:440
Vehicle::GetFirstOrder
Order * GetFirstOrder() const
Get the first order of the vehicles order list.
Definition: vehicle_base.h:700
SpecializedVehicle::From
static T * From(Vehicle *v)
Converts a Vehicle to SpecializedVehicle with type checking.
Definition: vehicle_base.h:1201
Vehicle::x_offs
int8_t x_offs
x offset for vehicle sprite
Definition: vehicle_base.h:316
Vehicle::z_extent
byte z_extent
z-extent of vehicle bounding box
Definition: vehicle_base.h:313
Vehicle::date_of_last_service_newgrf
TimerGameCalendar::Date date_of_last_service_newgrf
Last calendar date the vehicle had a service at a depot, unchanged by the date cheat to protect again...
Definition: vehicle_base.h:291
Vehicle::GetFirstEnginePart
Vehicle * GetFirstEnginePart()
Get the first part of an articulated engine.
Definition: vehicle_base.h:969
Vehicle::InvalidateNewGRFCacheOfChain
void InvalidateNewGRFCacheOfChain()
Invalidates cached NewGRF variables of all vehicles in the chain (after the current vehicle)
Definition: vehicle_base.h:499
FreeUnitIDGenerator::maxid
UnitID maxid
maximum ID at the moment of constructor call
Definition: vehicle_base.h:1276
OrderList
Shared order list linking together the linked list of orders and the list of vehicles sharing this or...
Definition: order_base.h:260
RefitDesc::capacity
uint16_t capacity
Capacity the vehicle will have.
Definition: vehicle_base.h:216
VF_SERVINT_IS_PERCENT
@ VF_SERVINT_IS_PERCENT
Service interval is percent.
Definition: vehicle_base.h:54
Vehicle::cargo_payment
CargoPayment * cargo_payment
The cargo payment we're currently in.
Definition: vehicle_base.h:273
Vehicle::reliability
uint16_t reliability
Reliability.
Definition: vehicle_base.h:292
Vehicle::NextShared
Vehicle * NextShared() const
Get the next vehicle of the shared vehicle chain.
Definition: vehicle_base.h:709
OrderList::GetLastOrder
Order * GetLastOrder() const
Get the last order of the order chain.
Definition: order_base.h:306
VE_DISABLE_WAGON_POWER
@ VE_DISABLE_WAGON_POWER
Flag to disable wagon power.
Definition: vehicle_base.h:93
SpecializedVehicle::IsValidID
static bool IsValidID(size_t index)
Tests whether given index is a valid index for vehicle of this type.
Definition: vehicle_base.h:1173
Vehicle::age
TimerGameCalendar::Date age
Age in days.
Definition: vehicle_base.h:288
Vehicle::HasArticulatedPart
bool HasArticulatedPart() const
Check if an engine has an articulated part.
Definition: vehicle_base.h:949
Vehicle::profit_last_year
Money profit_last_year
Profit last year << 8, low 8 bits are fract.
Definition: vehicle_base.h:270
Vehicle::breakdown_chance
byte breakdown_chance
Current chance of breakdowns.
Definition: vehicle_base.h:297
GVSF_MULTIHEADED
@ GVSF_MULTIHEADED
Engine is multiheaded (not used for road vehicles).
Definition: vehicle_base.h:119
GroupID
uint16_t GroupID
Type for all group identifiers.
Definition: group_type.h:13
PalSpriteID
Combination of a palette sprite and a 'real' sprite.
Definition: gfx_type.h:22
Vehicle::unitnumber
UnitID unitnumber
unit number, for display purposes only
Definition: vehicle_base.h:321
ClosestDepot::destination
DestinationID destination
The DestinationID as used for orders.
Definition: vehicle_base.h:228
SpecializedVehicle::GetIfValid
static T * GetIfValid(size_t index)
Returns vehicle if the index is a valid index for this vehicle type.
Definition: vehicle_base.h:1191
Vehicle::HasUnbunchingOrder
bool HasUnbunchingOrder() const
Check if the current vehicle has an unbunching order.
Definition: vehicle.cpp:2427
VF_AUTOFILL_PRES_WAIT_TIME
@ VF_AUTOFILL_PRES_WAIT_TIME
Whether non-destructive auto-fill should preserve waiting times.
Definition: vehicle_base.h:50
SpecializedVehicle::Iterate
static Pool::IterateWrapper< T > Iterate(size_t from=0)
Returns an iterable ensemble of all valid vehicles of type T.
Definition: vehicle_base.h:1270
Vehicle::LoadOldVehicle
friend bool LoadOldVehicle(LoadgameState *ls, int num)
So we can set the proper next pointer while loading.
Definition: oldloader_sl.cpp:1241
NCVV_END
@ NCVV_END
End of the bits.
Definition: vehicle_base.h:64
VE_ADVANCED_EFFECT
@ VE_ADVANCED_EFFECT
Flag for advanced effects.
Definition: vehicle_base.h:92
Vehicle::hash_viewport_prev
Vehicle ** hash_viewport_prev
NOSAVE: Previous vehicle in the visual location hash.
Definition: vehicle_base.h:278
Vehicle::y_pos
int32_t y_pos
y coordinate.
Definition: vehicle_base.h:300
ClosestDepot
Structure to return information about the closest depot location, and whether it could be found.
Definition: vehicle_base.h:226
Vehicle::breakdown_delay
byte breakdown_delay
Counter for managing breakdown length.
Definition: vehicle_base.h:295
Vehicle::Last
Vehicle * Last()
Get the last vehicle of this vehicle chain.
Definition: vehicle_base.h:646
Vehicle::GetDisplayMaxWeight
uint32_t GetDisplayMaxWeight() const
Calculates the maximum weight of the ground vehicle when loaded.
Definition: vehicle.cpp:3169
Vehicle::coord
Rect coord
NOSAVE: Graphical bounding box of the vehicle, i.e. what to redraw on moves.
Definition: vehicle_base.h:275
Vehicle::NeedsServicing
bool NeedsServicing() const
Check if the vehicle needs to go to a depot in near future (if a opportunity presents itself) for ser...
Definition: vehicle.cpp:190
Vehicle::InvalidateNewGRFCache
void InvalidateNewGRFCache()
Invalidates cached NewGRF variables.
Definition: vehicle_base.h:490
network.h
Vehicle::subtype
byte subtype
subtype (Filled with values from AircraftSubType/DisasterSubType/EffectVehicleType/GroundVehicleSubty...
Definition: vehicle_base.h:358
VF_TIMETABLE_STARTED
@ VF_TIMETABLE_STARTED
Whether the vehicle has started running on the timetable yet.
Definition: vehicle_base.h:48
OrderList::GetFirstOrder
Order * GetFirstOrder() const
Get the first order of the order chain.
Definition: order_base.h:298
Vehicle::day_counter
byte day_counter
Increased by one for each day.
Definition: vehicle_base.h:344
VS_UNCLICKABLE
@ VS_UNCLICKABLE
Vehicle is not clickable by the user (shadow vehicles).
Definition: vehicle_base.h:35
NewGRFCacheValidValues
NewGRFCacheValidValues
Bit numbers used to indicate which of the NewGRFCache values are valid.
Definition: vehicle_base.h:58
GVSF_FRONT
@ GVSF_FRONT
Leading engine of a consist.
Definition: vehicle_base.h:114
Vehicle::NeedsAutorenewing
bool NeedsAutorenewing(const Company *c, bool use_renew_setting=true) const
Function to tell if a vehicle needs to be autorenewed.
Definition: vehicle.cpp:145
VF_PATHFINDER_LOST
@ VF_PATHFINDER_LOST
Vehicle's pathfinder is lost.
Definition: vehicle_base.h:52
Vehicle::progress
byte progress
The percentage (if divided by 256) this vehicle already crossed the tile unit.
Definition: vehicle_base.h:327
NewGRFCache::company_information
uint32_t company_information
Cache for NewGRF var 43.
Definition: vehicle_base.h:73
OverflowSafeInt< int64_t >
Vehicle::IsStoppedInDepot
bool IsStoppedInDepot() const
Check whether the vehicle is in the depot and stopped.
Definition: vehicle_base.h:555
Vehicle::FixOldVehicles
friend void FixOldVehicles()
Convert the old style vehicles into something that resembles the old new style savegames.
Definition: oldloader_sl.cpp:163
Vehicle::previous
Vehicle * previous
NOSAVE: pointer to the previous vehicle in the chain.
Definition: vehicle_base.h:245
Vehicle::cargo_type
CargoID cargo_type
type of cargo this vehicle is carrying
Definition: vehicle_base.h:336
Vehicle::spritenum
byte spritenum
currently displayed sprite index 0xfd == custom sprite, 0xfe == custom second head sprite 0xff == res...
Definition: vehicle_base.h:310
NCVV_COMPANY_INFORMATION
@ NCVV_COMPANY_INFORMATION
This bit will be set if the NewGRF var 43 currently stored is valid.
Definition: vehicle_base.h:62
SlVehicleDisaster
Definition: vehicle_sl.cpp:953
FreeUnitIDGenerator::FreeUnitIDGenerator
FreeUnitIDGenerator(VehicleType type, CompanyID owner)
Initializes the structure.
Definition: vehicle.cpp:1825
SpecializedVehicle::GetLastEnginePart
T * GetLastEnginePart()
Get the last part of an articulated engine.
Definition: vehicle_base.h:1154
SB
constexpr T SB(T &x, const uint8_t s, const uint8_t n, const U d)
Set n bits in x starting at bit s to d.
Definition: bitmath_func.hpp:58
Vehicle::OnNewCalendarDay
virtual void OnNewCalendarDay()
Calls the new calendar day handler of the vehicle.
Definition: vehicle_base.h:572
PalSpriteID::pal
PaletteID pal
The palette (use PAL_NONE) if not needed)
Definition: gfx_type.h:24
Vehicle::GetGroundVehicleFlags
uint16_t & GetGroundVehicleFlags()
Access the ground vehicle flags of the vehicle.
Definition: vehicle.cpp:3110
EngineID
uint16_t EngineID
Unique identification number of an engine.
Definition: engine_type.h:21
SpecializedVehicle::Previous
T * Previous() const
Get previous vehicle in the chain.
Definition: vehicle_base.h:1122
Trackdir
Trackdir
Enumeration for tracks and directions.
Definition: track_type.h:67
Vehicle::cargo_subtype
byte cargo_subtype
Used for livery refits (NewGRF variations)
Definition: vehicle_base.h:337
NewGRFCache::cache_valid
uint8_t cache_valid
Bitset that indicates which cache values are valid.
Definition: vehicle_base.h:75
VEH_TRAIN
@ VEH_TRAIN
Train vehicle type.
Definition: vehicle_type.h:24
Vehicle::GetOrderStationLocation
virtual TileIndex GetOrderStationLocation([[maybe_unused]] StationID station)
Determine the location for the station where the vehicle goes to next.
Definition: vehicle_base.h:786
Pool::PoolItem<&_vehicle_pool >::IsValidID
static bool IsValidID(size_t index)
Tests whether given index can be used to get valid (non-nullptr) Titem.
Definition: pool_type.hpp:324
Vehicle::GetAdvanceDistance
uint GetAdvanceDistance()
Determines the vehicle "progress" needed for moving a step.
Definition: vehicle_base.h:452
Vehicle::GetOrder
Order * GetOrder(int index) const
Returns order 'index' of a vehicle or nullptr when it doesn't exists.
Definition: vehicle_base.h:908
BaseVehicle::type
VehicleType type
Type of vehicle.
Definition: vehicle_type.h:51
Vehicle::Tick
virtual bool Tick()
Calls the tick handler of the vehicle.
Definition: vehicle_base.h:567
Vehicle::UpdatePositionAndViewport
void UpdatePositionAndViewport()
Update the position of the vehicle, and update the viewport.
Definition: vehicle.cpp:1739
SpecializedVehicle::First
T * First() const
Get the first vehicle in the chain.
Definition: vehicle_base.h:1098
Vehicle::UpdatePosition
void UpdatePosition()
Update the position of the vehicle.
Definition: vehicle.cpp:1668
Vehicle::hash_tile_prev
Vehicle ** hash_tile_prev
NOSAVE: Previous vehicle in the tile location hash.
Definition: vehicle_base.h:281
ExpensesType
ExpensesType
Types of expenses.
Definition: economy_type.h:172
Vehicle::HandleBreakdown
bool HandleBreakdown()
Handle all of the aspects of a vehicle breakdown This includes adding smoke and sounds,...
Definition: vehicle.cpp:1357
VESM_ELECTRIC
@ VESM_ELECTRIC
Electric model.
Definition: vehicle_base.h:103
Rect
Specification of a rectangle with absolute coordinates of all edges.
Definition: geometry_type.hpp:75
Company
Definition: company_base.h:116
group_type.h
Vehicle::GetNumOrders
VehicleOrderID GetNumOrders() const
Get the number of orders this vehicle has.
Definition: vehicle_base.h:733
BaseConsist
Various front vehicle properties that are preserved when autoreplacing, using order-backup or switchi...
Definition: base_consist.h:17
SpecializedVehicle::Last
T * Last()
Get the last vehicle in the chain.
Definition: vehicle_base.h:1104
InvalidateVehicleOrder
void InvalidateVehicleOrder(const Vehicle *v, int data)
Updates the widgets of a vehicle which contains the order-data.
Definition: order_cmd.cpp:251
Vehicle::orders
OrderList * orders
Pointer to the order list for this vehicle.
Definition: vehicle_base.h:352
VehicleSpriteSeq::GetBounds
void GetBounds(Rect *bounds) const
Determine shared bounds of all sprites.
Definition: vehicle.cpp:103
Vehicle::hash_tile_next
Vehicle * hash_tile_next
NOSAVE: Next vehicle in the tile location hash.
Definition: vehicle_base.h:280
Pool::PoolItem
Base class for all PoolItems.
Definition: pool_type.hpp:233
BaseConsist::CopyConsistPropertiesFrom
void CopyConsistPropertiesFrom(const BaseConsist *src)
Copy properties of other BaseConsist.
Definition: base_consist.cpp:22
Vehicle::DeleteUnreachedImplicitOrders
void DeleteUnreachedImplicitOrders()
Delete all implicit orders which were not reached.
Definition: vehicle.cpp:2135
Vehicle::first
Vehicle * first
NOSAVE: pointer to the first vehicle in the chain.
Definition: vehicle_base.h:246
Order::next
Order * next
Pointer to next order. If nullptr, end of list.
Definition: order_base.h:59
SpecializedVehicle::UpdateViewport
void UpdateViewport(bool force_update, bool update_delta)
Update vehicle sprite- and position caches.
Definition: vehicle_base.h:1223
Vehicle::fill_percent_te_id
TextEffectID fill_percent_te_id
a text-effect id to a loading indicator object
Definition: vehicle_base.h:320
Order
Definition: order_base.h:36
SpecializedVehicle::GetPrevVehicle
T * GetPrevVehicle() const
Get the previous real (non-articulated part) vehicle in the consist.
Definition: vehicle_base.h:1166
VS_SHADOW
@ VS_SHADOW
Vehicle is a shadow vehicle.
Definition: vehicle_base.h:38
Vehicle::LeaveUnbunchingDepot
void LeaveUnbunchingDepot()
Leave an unbunching depot and calculate the next departure time for shared order vehicles.
Definition: vehicle.cpp:2438
MutableSpriteCache::old_coord
Rect old_coord
Co-ordinates from the last valid bounding box.
Definition: vehicle_base.h:194
OrderList::GetNumOrders
VehicleOrderID GetNumOrders() const
Get number of orders in the order list.
Definition: order_base.h:320
Vehicle::GetDisplayProfitLastYear
Money GetDisplayProfitLastYear() const
Gets the profit vehicle had last year.
Definition: vehicle_base.h:618
VE_OFFSET_CENTRE
@ VE_OFFSET_CENTRE
Value of offset corresponding to a position above the centre of the vehicle.
Definition: vehicle_base.h:82
Vehicle::ShiftDates
void ShiftDates(TimerGameEconomy::Date interval)
Shift all dates by given interval.
Definition: vehicle.cpp:777
SpecializedVehicle::GetFirstEnginePart
T * GetFirstEnginePart()
Get the first part of an articulated engine.
Definition: vehicle_base.h:1142
VE_TYPE_STEAM
@ VE_TYPE_STEAM
Steam plumes.
Definition: vehicle_base.h:87
RefitDesc
Simulated cargo type and capacity for prediction of future links.
Definition: vehicle_base.h:214
track_type.h
order_func.h
Vehicle::y_offs
int8_t y_offs
y offset for vehicle sprite
Definition: vehicle_base.h:317
Vehicle::MarkDirty
virtual void MarkDirty()
Marks the vehicles to be redrawn and updates cached variables.
Definition: vehicle_base.h:402
GRFFile
Dynamic data of a loaded NewGRF.
Definition: newgrf.h:107
Vehicle::refit_cap
uint16_t refit_cap
Capacity left over from before last refit.
Definition: vehicle_base.h:339
NewGRFCache
Cached often queried (NewGRF) values.
Definition: vehicle_base.h:68
Vehicle::GetNextStoppingStation
StationIDStack GetNextStoppingStation() const
Get the next station the vehicle will stop at.
Definition: vehicle_base.h:745
RefitDesc::cargo
CargoID cargo
Cargo type the vehicle will be carrying.
Definition: vehicle_base.h:215
Vehicle::GetDisplayMinPowerToWeight
uint32_t GetDisplayMinPowerToWeight() const
Calculates the minimum power-to-weight ratio using the maximum weight of the ground vehicle.
Definition: vehicle.cpp:3184
HasBit
constexpr debug_inline bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
Definition: bitmath_func.hpp:103