38 v->other_multiheaded_part =
nullptr;
42 if (v->IsFrontEngine() || v->IsFreeWagon()) {
56 bool sequential_matching = v->IsFrontEngine();
59 if (u->other_multiheaded_part !=
nullptr)
continue;
61 if (u->IsMultiheaded()) {
71 if (sequential_matching) {
90 if (stack_pos == 0)
break;
101 u->ClearMultiheaded();
118 if (
HasBit(t->subtype, 7) && ((t->subtype & ~0x80) == 0 || (t->subtype & ~0x80) == 4)) {
119 for (
Train *u = t; u !=
nullptr; u = u->
Next()) {
123 switch (u->subtype) {
132 u->SetArticulatedPart();
169 st->airport.blocks = {};
175 if (a->IsNormalAircraft()) {
185 a->cur_speed = a->vcache.cached_max_speed;
186 if (!a->current_order.IsType(OT_GOTO_STATION) && !a->current_order.IsType(OT_GOTO_DEPOT)) {
188 a->current_order.MakeDummy();
196 if (a->subtype ==
AIR_HELICOPTER) a->Next()->Next()->cur_speed = 32;
206 for (
auto iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ) {
209 iter = st->loading_vehicles.erase(iter);
242 if (v->engine_type >= total_engines || v->type != v->GetEngine()->type) {
243 v->engine_type = first_engine[v->type];
263 if (v->Next() !=
nullptr) v->Next()->previous = v;
264 if (v->NextShared() !=
nullptr) v->NextShared()->previous_shared = v;
266 if (part_of_load) v->fill_percent_te_id = INVALID_TE_ID;
269 if (v->IsGroundVehicle()) v->GetGroundVehicleCache()->first_engine = EngineID::Invalid();
281 std::map<uint32_t, OrderList *> mapping;
284 if (v->orders !=
nullptr) {
286 if (mapping[v->old_orders] ==
nullptr) {
293 std::vector<Order>
orders;
295 orders.push_back(std::move(old_order->order));
299 v->orders = mapping[v->old_orders];
302 v->AddToShared(v->orders->GetFirstSharedVehicle());
306 if (v->PreviousShared() ==
nullptr) {
307 v->orders->Initialize(v);
316 if (v->Previous() ==
nullptr) {
317 for (
Vehicle *u = v; u !=
nullptr; u = u->
Next()) {
323 if (v->Next() ==
nullptr) {
334 if (v->First() != v || v->orders !=
nullptr || v->previous_shared !=
nullptr || v->next_shared ==
nullptr)
continue;
339 v->orders->first_shared = v;
341 u->orders = v->orders;
349 if (rv->subtype == 0) {
351 rv->SetFrontEngine();
352 }
else if (rv->subtype == 1) {
355 rv->SetArticulatedPart();
366 v->current_order.Free();
382 if (!v->IsPrimaryVehicle())
continue;
387 v->SetServiceIntervalIsCustom(v->GetServiceInterval() != interval);
395 s->rotation = s->direction;
399 if (s->rotation == s->direction)
continue;
404 s->rotation_x_pos = s->x_pos;
405 s->rotation_y_pos = s->y_pos;
413 if (v->timetable_start == 0)
continue;
437 assert(v->First() !=
nullptr);
515 if (shadow ==
nullptr)
SlErrorCorrupt(
"Missing shadow for aircraft");
522 if (rotor ==
nullptr)
SlErrorCorrupt(
"Missing rotor for helicopter");
551 if (part_of_load && v->unitnumber != 0) {
552 Company::Get(v->owner)->freeunits[v->type].UseID(v->unitnumber);
559 v->UpdateViewport(
false);
584 for (done = 0; done < diff; done++) {
588 if (next !=
nullptr && done < diff && u->IsFrontEngine()) {
608 for (moved = 0; moved < diff + 1; moved++) {
615 u->force_proceed = old_tfp;
619 if (moved < diff + 1)
break;
647static uint8_t _cargo_periods;
648static StationID _cargo_source;
650static uint16_t _cargo_count;
651static uint16_t _cargo_paid_for;
652static Money _cargo_feeder_share;
656 static inline const SaveLoad description[] = {
807 static inline const SaveLoad description[] = {
841 static inline const SaveLoad description[] = {
858 static inline const SaveLoad description[] = {
878 Debug(sl, 1,
"Found RoadVehicle {} with invalid path cache, ignoring.", rv.index);
885 for (
size_t c = 0; c < n; ++c) {
890 std::reverse(std::begin(rv.
path), std::end(rv.
path));
917 static inline const SaveLoad description[] = {
927 static inline std::vector<Trackdir> ship_path_td;
929 static inline const SaveLoad description[] = {
952 std::transform(std::rbegin(ship_path_td), std::rend(ship_path_td), std::back_inserter(s->
path), [](
Trackdir trackdir) { return trackdir; });
965 static inline const SaveLoad description[] = {
1005 static inline const SaveLoad description[] = {
1050 static inline const SaveLoad description[] = {
1106static const SaveLoad _vehicle_desc[] = {
1116struct VEHSChunkHandler : ChunkHandler {
1125 SlSetArrayIndex(v->index);
void GetAircraftFlightLevelBounds(const Vehicle *v, int *min, int *max)
Get the 'flight level' bounds, in pixels from 'z_pos' 0 for a particular vehicle for normal flight si...
void AircraftNextAirportPos_and_Order(Aircraft *v)
Set the right pos when heading to other airports after takeoff.
void AircraftLeaveHangar(Aircraft *v, Direction exit_dir)
Aircraft is about to leave the hangar.
void SetAircraftPosition(Aircraft *v, int x, int y, int z)
Set aircraft position.
@ AIR_HELICOPTER
an helicopter
void UpdateAircraftCache(Aircraft *v, bool update_range=false)
Update cached values of an aircraft.
@ HANGAR
Heading for hangar.
@ FLYING
Vehicle is flying in the air.
static constexpr uint GB(const T x, const uint8_t s, const uint8_t n)
Fetch n bits from x, started at bit s.
constexpr T SetBit(T &x, const uint8_t y)
Set a bit in a variable.
constexpr bool HasBit(const T x, const uint8_t y)
Checks if a bit in a value is set.
constexpr T ClrBit(T &x, const uint8_t y)
Clears a bit in a variable.
constexpr Timpl & Reset()
Reset all bits.
constexpr Timpl & Set()
Set all bits.
Default handler for saving/loading an object to/from disk.
SaveLoadTable GetDescription() const override
static Pool::IterateWrapperFiltered< Engine, EngineTypeFilter > IterateType(VehicleType vt, size_t from=0)
Returns an iterable ensemble of all valid engines of the given type.
RoadTypes powered_roadtypes
bitmask to the OTHER roadtypes on which a vehicle of THIS roadtype generates power
SaveLoadTable GetLoadDescription() const
Get the description for how to load the chunk.
void Load(Vehicle *v) const override
Load the object from disk.
void FixPointers(Vehicle *v) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
void Save(Vehicle *v) const override
Save the object to disk.
void Save(Vehicle *v) const override
Save the object to disk.
void FixPointers(Vehicle *v) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
void Load(Vehicle *v) const override
Load the object from disk.
void Save(Vehicle *v) const override
Save the object to disk.
void Load(Vehicle *v) const override
Load the object from disk.
void FixPointers(Vehicle *v) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
void FixPointers(Vehicle *v) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
void Save(Vehicle *v) const override
Save the object to disk.
void Load(Vehicle *v) const override
Load the object from disk.
std::vector< RoadVehPathElement > & GetVector(RoadVehicle *rv) const override
Get instance of vector to load/save.
void Load(Vehicle *v) const override
Load the object from disk.
void FixPointers(Vehicle *v) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
static std::vector< TileIndex > rv_path_tile
static std::vector< Trackdir > rv_path_td
void Save(Vehicle *v) const override
Save the object to disk.
std::vector< ShipPathElement > & GetVector(Ship *s) const override
Get instance of vector to load/save.
void Load(Vehicle *v) const override
Load the object from disk.
void FixPointers(Vehicle *v) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
void Save(Vehicle *v) const override
Save the object to disk.
void FixPointers(Vehicle *v) const override
A post-load callback to fix SaveLoadType::Reference integers into pointers.
void Load(Vehicle *v) const override
Load the object from disk.
void Save(Vehicle *v) const override
Save the object to disk.
StrongType::Typedef< int32_t, DateTag< struct Economy >, StrongType::Compare, StrongType::Integer > Date
Default handler for saving/loading a vector to/from disk.
void Append(CargoPacket *cp, MoveToAction action=MoveToAction::Keep)
Appends the given cargo packet.
Definition of stuff that is very close to a company, like the company struct itself.
int CompanyServiceInterval(const Company *c, VehicleType type)
Get the service interval for the given company and vehicle type.
Functions related to companies.
Functions related to debugging.
#define Debug(category, level, format_string,...)
Output a line of debugging information.
@ ST_SMALL_UFO
Small UFO, tries to find a road vehicle to destroy.
Base classes related to the economy.
Base class for all effect vehicles.
PoolID< uint16_t, struct EngineIDTag, 64000, 0xFFFF > EngineID
Unique identification number of an engine.
@ Multihead
indicates a combination of two locomotives
@ Wagon
simple wagon, not motorized
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23).
static constexpr GroupID DEFAULT_GROUP
Ungrouped vehicles are in this group.
uint8_t _age_cargo_skip_counter
Skip aging of cargo? Used before savegame version 162.
OldOrderSaveLoadItem * GetOldOrder(size_t pool_index)
Get a pointer to an old order with the given reference index.
int TicksToLeaveDepot(const Train *v)
Compute number of ticks when next wagon will leave a depot.
Track GetRailDepotTrack(Tile t)
Returns the track of a depot, ignoring direction.
const RoadTypeInfo * GetRoadTypeInfo(RoadType roadtype)
Returns a pointer to the Roadtype information for a given roadtype.
RoadType GetRoadType(Tile t, RoadTramType rtt)
Get the road type for the given RoadTramType.
@ INVALID_ROADTYPE
flag for invalid roadtype
RoadTramType
The different types of road type.
void RoadVehUpdateCache(RoadVehicle *v, bool same_length=false)
Update the cache of a road vehicle.
A number of safeguards to prevent using unsafe methods.
std::vector< SaveLoad > SlCompatTableHeader(const SaveLoadTable &slt, const SaveLoadCompatTable &slct)
Load a table header in a savegame compatible way.
int SlIterateArray()
Iterate through the elements of an array and read the whole thing.
void SlErrorCorrupt(const std::string &msg)
Error handler for corrupt savegames.
uint8_t SlReadByte()
Wrapper for reading a byte from the buffer.
void SlObject(void *object, const SaveLoadTable &slt)
Main SaveLoad function.
std::vector< SaveLoad > SlTableHeader(const SaveLoadTable &slt)
Save or Load a table header.
Functions/types related to saving and loading games.
@ U64
A 64 bit unsigned int.
@ U32
A 32 bit unsigned int.
@ I32
A 32 bit signed int.
@ I64
A 64 bit signed int.
@ U16
A 16 bit unsigned int.
@ U8
A 8 bit unsigned int.
@ I16
A 16 bit signed int.
@ U32
A 32 bit unsigned int.
@ I32
A 32 bit signed int.
@ U16
A 16 bit unsigned int.
#define SLEG_CONDVAR(name, variable, type, from, to)
Storage of a global variable in some savegame versions.
#define SLEG_CONDVECTOR(name, variable, type, from, to)
Storage of a global vector of SaveLoadType::Variable elements in some savegame versions.
std::reference_wrapper< const ChunkHandler > ChunkHandlerRef
A reference to ChunkHandler.
@ CargoPacket
Load/save a reference to a cargo packet.
@ OrderList
Load/save a reference to an orderlist.
@ OldVehicle
Load/save an old-style reference to a vehicle (for pre-4.4 savegames).
@ Vehicle
Load/save a reference to a vehicle.
std::span< const ChunkHandlerRef > ChunkHandlerTable
A table of ChunkHandler entries.
#define SLE_SAVEBYTE(base, variable)
Only write byte during saving; never read it during loading.
#define SLE_REF(base, variable, type)
Storage of a reference in every version of a savegame.
#define SLE_CONDREFLIST(base, variable, type, from, to)
Storage of a list of SaveLoadType::Reference elements in some savegame versions.
#define SLE_CONDARR(base, variable, type, length, from, to)
Storage of a fixed-size array of SaveLoadType::Variable elements in some savegame versions.
std::span< const struct SaveLoadCompat > SaveLoadCompatTable
A table of SaveLoadCompat entries.
#define SLEG_STRUCT(name, handler)
Storage of a structs in every savegame version.
#define SLE_CONDSSTR(base, variable, type, from, to)
Storage of a std::string in some savegame versions.
#define SLE_CONDVAR(base, variable, type, from, to)
Storage of a variable in some savegame versions.
bool IsSavegameVersionBefore(SaveLoadVersion major, uint8_t minor=0)
Checks whether the savegame is below major.
@ LastLoadingTick
Saveload version: 301, GitHub pull request: 9693 Store tick of last loading for vehicles.
@ BigDates
Saveload version: 31, SVN revision: 5999 Change date from 1920 - 2090 to 0 - 5 000 000.
@ FractionProfitRunningTicks
Saveload version: 88, SVN revision: 12134 Store vehicle profits as a (fixed point) fraction,...
@ VehicleEconomyAge
Saveload version: 334, GitHub pull request: 12141, release: 14.0 Add vehicle age in economy year,...
@ GoalProgressPlaneAcceleration
Saveload version: 182, SVN revision: 25115, r25259, r25296 Goal status and plane acceleration fixes.
@ LiveryRefit
Saveload version: 35, SVN revision: 6602 NewGRF livery refits.
@ CountPaidForCargo
Saveload version: 45, SVN revision: 8501 Count the amount of cargo that was paid for.
@ UnifyCurrency
Saveload version: 65, SVN revision: 10210 Make all variables related to currency 64 bits.
@ DisasterVehState
Saveload version: 312, GitHub pull request: 10798 Explicit storage of disaster vehicle state.
@ CargoReservation
Saveload version: 181, SVN revision: 25012 Persist the reservation of cargo for vehicles instead of ...
@ LargerUnitNumber
Saveload version: 8.0, SVN revision: 1786 Increase size of (vehicle) unit numbers.
@ ReplaceCustomNameArray
Saveload version: 84, SVN revision: 11822 Replace single fixed size array of custom names,...
@ OrderList
Saveload version: 105, SVN revision: 14803 Create separate order list objects for maintaining orders...
@ PathCacheFormat
Saveload version: 346, GitHub pull request: 12345 Vehicle path cache format changed.
@ VehicleCurrencyStationChanges
Saveload version: 2.0, release: 0.3.0 Adding vehicle state, larger currency size for statistics,...
@ ShipPathCache
Saveload version: 203, GitHub pull request: 7072 Add path cache for ships.
@ TrackRealAndAutoOrders
Saveload version: 158, SVN revision: 21933 Track which real and auto order is the current order.
@ VehicleCentreAndZPos
Saveload version: 164, SVN revision: 23290 Vehicle centres are not fixed at 4/8 of the vehicle; chan...
@ BigMap
Saveload version: 5.0, SVN revision: 1429 Making maps a different size than 256x256.
@ LargerCargoSource
Saveload version: 7.0, SVN revision: 1770 With more stations, the size of the cargo source needed to...
@ NewGRFLastService
Saveload version: 317, GitHub pull request: 11124 Added stable date_of_last_service to avoid NewGRF ...
@ MoreCargoPackets
Saveload version: 69, SVN revision: 10319 Allow more than ~65k cargo packets.
@ LinkgraphLocationDisasterStore
Saveload version: 191, SVN revision: 26636, 26646 Fix disaster vehicle storage, Linkgraph - store lo...
@ RoadvehPathCache
Saveload version: 211, GitHub pull request: 7261 Add path cache for road vehicles.
@ RefitOrders
Saveload version: 36, SVN revision: 6624 Vehicles can be refitted as part of an order.
@ UnifyGroundVehicles
Saveload version: 157, SVN revision: 21862 Unify the way ground vehicles are handled (articulated pa...
@ CargoSourceTile
Saveload version: 44, SVN revision: 8144 Store the source tile of the cargo, so accurate payment can...
@ VehMotionCounter
Saveload version: 288, GitHub pull request: 8591 Desync safe motion counter.
@ TimetableStartTicks
Saveload version: 321, GitHub pull request: 11468 Convert timetable start from a date to ticks.
@ CurrentOrderMaxSpeed
Saveload version: 174, SVN revision: 23973, release: 1.2.x Save maximum speed of current order.
@ MultipleRoadStops
Saveload version: 6.0, SVN revision: 1721 Multi tile road stops, and some map size related fixes.
@ VehicleGroups
Saveload version: 60, SVN revision: 9874 Arbitrary grouping, by the player, of vehicles.
@ ServiceIntervalPercent
Saveload version: 180, SVN revision: 24998, release: 1.3.x Service interval in percent or days store...
@ NewGRFCustomCargoAging
Saveload version: 162, SVN revision: 22713 NewGRF influence on aging of cargo in vehicles.
@ DisallowRoadReconstruction
Saveload version: 160, SVN revision: 21974, release: 1.1.x Setting to disallow road reconstruction.
@ TimetableTicksType
Saveload version: 323, GitHub pull request: 11435 Convert timetable current order time to ticks.
@ NewGRFAircraftRange
Saveload version: 167, SVN revision: 23504 NewGRF provided maximum aircraft range.
@ ExtendVehicleRandom
Saveload version: 310, GitHub pull request: 10701 Extend vehicle random bits.
@ MinVersion
First savegame version.
@ SplitLoadWaitCounters
Saveload version: 136, SVN revision: 18764 Split counters for (un)loading and signal waiting/turning...
@ SplitHQ
Saveload version: 112, SVN revision: 15290 Split the behaviour of headquarters from the other unmova...
@ FeederShare
Saveload version: 51, SVN revision: 8978 Rewrite of transfers to retain knowledge about the already ...
@ DepotUnbunching
Saveload version: 331, GitHub pull request: 11945 Allow unbunching shared order vehicles at a depot.
@ ShipRotation
Saveload version: 204, GitHub pull request: 7065 Add extra rotation stages for ships.
@ Timetables
Saveload version: 67, SVN revision: 10236 Introduce timetables for vehicles.
@ RvRealisticAcceleration
Saveload version: 139, SVN revision: 19346 Realistic acceleration of road vehicles.
@ Yapp
Saveload version: 100, SVN revision: 13952 New version of path based signals.
@ CargoPackets
Saveload version: 68, SVN revision: 10266 Account for individual units of cargo, i....
@ MaxBridgeMapHeight
Saveload version: 194, SVN revision: 26881, release: 1.5 Setting for maximum bridge and map height.
@ TimetableStart
Saveload version: 129, SVN revision: 18292 Allow setting the start date of a timetable.
@ MaxVersion
Highest possible saveload version.
@ GradualLoading
Saveload version: 40, SVN revision: 7326 Gradual (un)loading of cargo.
#define SLE_CONDREF(base, variable, type, from, to)
Storage of a reference in some savegame versions.
#define SLEG_CONDSTRUCTLIST(name, handler, from, to)
Storage of a list of structs in some savegame versions.
@ SparseTable
A SparseArray with a header describing the elements.
#define SLE_VAR(base, variable, type)
Storage of a variable in every version of a savegame.
#define SLE_CONDVARNAME(base, variable, name, type, from, to)
Storage of a variable in some savegame versions.
GameSettings _settings_game
Game settings of a running game or the scenario editor.
Base classes/functions for stations.
Definition of base types and functions in a cross-platform compatible way.
@ AllowControlCode
Allow the special control codes.
Aircraft, helicopters, rotors and their shadows belong to this class.
VehicleType type
Type of vehicle.
Container for cargo from the same location and time.
CompanySettings settings
settings specific for each company
VehicleDefaultSettings vehicle
default settings for vehicles
Disasters, like submarines, skyrangers and their shadows, belong to this class.
A special vehicle is one of the following:
Position information of a vehicle after it moved.
int y
x and y position of the vehicle after moving
uint16_t last_speed
The last speed we did display, so we only have to redraw when this changes.
GroundVehicleCache gcache
Cache of often calculated values.
void CargoChanged()
Recalculates the cached weight of a vehicle and its parts.
bool IsEngine() const
Check if a vehicle is an engine (can be first in a consist).
bool IsMultiheaded() const
Check if the vehicle is a multiheaded engine.
bool IsFreeWagon() const
Check if the vehicle is a free wagon (got no engine in front of it).
void ClearEngine()
Clear engine status.
VehicleSpriteSeq sprite_seq
Vehicle appearance.
Compatibility struct to allow saveload of pool-based orders.
std::vector< Order > orders
Orders of the order list.
bool IsType(OrderType type) const
Check whether this order is of the given type.
uint8_t type
The type of order + non-stop flags.
uint8_t flags
Load/unload types, depot order/action types.
static Pool::IterateWrapper< Vehicle > Iterate(size_t from=0)
static size_t GetPoolSize()
static T * Create(Targs &&... args)
static T * CreateAtIndex(VehicleID index, Targs &&... args)
static Company * Get(auto index)
static bool CanAllocateItem(size_t n=1)
static Vehicle * GetIfValid(auto index)
Information about a rail vehicle.
RailVehicleType railveh_type
Type of rail vehicle.
Element of the RoadVehPathCache.
Information about a road vehicle.
Buses, trucks and trams belong to this class.
RoadTypes compatible_roadtypes
NOSAVE: Roadtypes this consist is powered on.
RoadVehPathCache path
Cached path.
RoadType roadtype
NOSAVE: Roadtype of this vehicle.
VehicleID disaster_vehicle
NOSAVE: Disaster vehicle targetting this vehicle.
Element of the ShipPathCache.
All ships have this type.
ShipPathCache path
Cached path.
void UpdateCache()
Update the caches of this ship.
static Pool::IterateWrapper< Station > Iterate(size_t from=0)
T * Next() const
Get next vehicle in the chain.
static Train * From(Vehicle *v)
T * GetNextVehicle() const
Get the next real (non-articulated part) vehicle in the consist.
'Train' is either a loco or a wagon.
Train * other_multiheaded_part
Link between the two ends of a multiheaded engine.
TrackBits track
On which track the train currently is.
void ConsistChanged(ConsistChangeFlags allowed_changes)
Recalculates the cached stuff of a train.
void FixPointers() const override
Fix the pointers.
void Load() const override
Load the chunk.
void Save() const override
Save the chunk.
static constexpr VarType U16
Store a 16 bits unsigned int.
static constexpr VarType U8
Store a 8 bits unsigned int.
static constexpr VarType STR
Store string.
static constexpr VarType NAME
A string stored in the custom string array.
static constexpr VarType I64
Store a 64 bits signed int.
static constexpr VarType U64
Store a 64 bits unsigned int.
static constexpr VarType U32
Store a 32 bits unsigned int.
static constexpr VarType I32
Store a 32 bits signed int.
bool servint_ispercent
service intervals are in percents
void CopyWithoutPalette(const VehicleSpriteSeq &src)
Copy data from another sprite sequence, while dropping all recolouring information.
CargoPayment * cargo_payment
The cargo payment we're currently in.
EngineID engine_type
The type of engine used for this vehicle.
VehicleCargoList cargo
The cargo this vehicle is carrying.
StationID last_loading_station
Last station the vehicle has stopped at and could possibly leave from with any cargo loaded.
GroupID group_id
Index of group Pool array.
VehStates vehstatus
Status.
Order current_order
The current order (+ status, like: loading).
Vehicle * Next() const
Get the next vehicle of this vehicle.
uint8_t spritenum
currently displayed sprite index 0xfd == custom sprite, 0xfe == custom second head sprite 0xff == res...
uint16_t cur_speed
current speed
bool IsFrontEngine() const
Check if the vehicle is a front engine.
MutableSpriteCache sprite_cache
Cache of sprites and values related to recalculating them, see MutableSpriteCache.
Vehicle * Previous() const
Get the previous vehicle of this vehicle.
TileIndex tile
Current tile index.
StationID last_station_visited
The last station we stopped at.
Vehicle * next_shared
pointer to the next vehicle that shares the order
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > > TileIndex
The index/ID of a Tile.
Trackdir
Enumeration for tracks and directions.
@ Depot
Special flag indicating a vehicle is inside a depot.
Base for the train class.
static constexpr ConsistChangeFlags CCF_TRACK
Valid changes while vehicle is driving, and possibly changing tracks.
static constexpr ConsistChangeFlags CCF_SAVELOAD
Valid changes when loading a savegame. (Everything that is not stored in the save....
TrainForceProceeding
Modes for ignoring signals.
@ TFP_SIGNAL
Ignore next signal, after the signal ignore being stuck.
GetNewVehiclePosResult GetNewVehiclePos(const Vehicle *v)
Get position information of a vehicle when moving one pixel in the direction it is facing.
uint8_t CalcPercentVehicleFilled(const Vehicle *front, StringID *colour)
Calculates how full a vehicle is.
@ Crashed
Vehicle is crashed.
@ Hidden
Vehicle is not visible.
@ Stopped
Vehicle is stopped by the player.
static const int32_t INVALID_COORD
Sentinel for an invalid coordinate.
Functions related to vehicles.
bool IsCompanyBuildableVehicleType(VehicleType type)
Is the given vehicle type buildable by a company?
void AfterLoadVehiclesPhase1(bool part_of_load)
Called after load for phase 1 of vehicle initialisation.
void FixupTrainLengths()
Fixup old train spacing.
void UpdateOldAircraft()
need to be called to load aircraft from old version
void ConvertOldMultiheadToNew()
Converts all trains to the new subtype format introduced in savegame 16.2 It also links multiheaded e...
void ReverseTrainSwapVehicles(Train *v)
Swap vehicles in chain starting from v, and reverse their direction.
bool TrainController(Train *v, Vehicle *nomove, bool reverse=true)
Move a vehicle chain one movement stop forwards.
void ConnectMultiheadedTrains()
Link front and rear multiheaded engines to each other This is done when loading a savegame.
void AfterLoadVehiclesPhase2(bool part_of_load)
Called after load for phase 2 of vehicle initialisation.
static void CheckValidVehicles()
Check all vehicles to ensure their engine type is valid for the currently loaded NewGRFs (that includ...
Loading of vehicle chunks before table headers were added.
const SaveLoadCompat _vehicle_train_sl_compat[]
Original field order for SlVehicleTrain.
const SaveLoadCompat _vehicle_disaster_sl_compat[]
Original field order for SlVehicleDisaster.
const SaveLoadCompat _vehicle_effect_sl_compat[]
Original field order for SlVehicleEffect.
const SaveLoadCompat _vehicle_ship_sl_compat[]
Original field order for SlVehicleShip.
const SaveLoadCompat _vehicle_sl_compat[]
Original field order for vehicle_desc.
const SaveLoadCompat _vehicle_roadveh_sl_compat[]
Original field order for SlVehicleRoadVeh.
const SaveLoadCompat _vehicle_common_sl_compat[]
Original field order for SlVehicleCommon.
const SaveLoadCompat _vehicle_aircraft_sl_compat[]
Original field order for SlVehicleAircraft.
@ OnMap
Vehicle drawn in viewport.
PoolID< uint32_t, struct VehicleIDTag, 0xFF000, 0xFFFFF > VehicleID
The type all our vehicle IDs have.
VehicleType
Available vehicle types.
@ Invalid
Non-existing type of vehicle.
@ Effect
Effect vehicle type (smoke, explosions, sparks, bubbles).
@ Aircraft
Aircraft vehicle type.
@ Disaster
Disaster vehicle type.
@ Train
Train vehicle type.
@ Original
Original acceleration model.
EnumIndexArray< T, VehicleType, Tend > VehicleTypeIndexArray
Array with VehicleType as index.
static const uint VEHICLE_LENGTH
The length of a vehicle in tile units.