# vehicle_base.h File Reference

Base class for all vehicles. More...

`#include "track_type.h"`
`#include "direction_type.h"`
`#include "command_type.h"`
`#include "order_base.h"`
`#include "cargopacket.h"`
`#include "texteff.hpp"`
`#include "engine_type.h"`
`#include "order_func.h"`
`#include "transport_type.h"`

Go to the source code of this file.

## Data Structures

struct | VehicleCache
| Cached oftenly queried (NewGRF) values. More...
struct | Vehicle
struct | SpecializedVehicle< T, Type >
| Class defining several overloaded accessors so we don't have to cast vehicle types that often. More...
struct | DisasterVehicle
| Disasters, like submarines, skyrangers and their shadows, belong to this class. More...
struct | FreeUnitIDGenerator
| Generates sequence of free UnitID numbers. More...

## Defines

#define | FOR_ALL_VEHICLES_FROM(var, start) FOR_ALL_ITEMS_FROM(Vehicle, vehicle_index, var, start)
#define | FOR_ALL_VEHICLES(var) FOR_ALL_VEHICLES_FROM(var, 0)
#define | FOR_ALL_VEHICLES_OF_TYPE(name, var) FOR_ALL_ITEMS_FROM(name, vehicle_index, var, 0) if (var->type == name::EXPECTED_TYPE)
#define | FOR_ALL_DISASTERVEHICLES(var) FOR_ALL_VEHICLES_OF_TYPE(DisasterVehicle, var)

## Typedefs

typedef Pool< Vehicle, VehicleID, 512, 64000 > | VehiclePool

## Enumerations

enum | VehStatus { VS_HIDDEN = 0x01, VS_STOPPED = 0x02, VS_UNCLICKABLE = 0x04, VS_DEFPAL = 0x08, VS_TRAIN_SLOWING = 0x10, VS_SHADOW = 0x20, VS_AIRCRAFT_BROKEN = 0x40, VS_CRASHED = 0x80 }
enum | VehicleFlags { VF_LOADING_FINISHED, VF_CARGO_UNLOADING, VF_BUILT_AS_PROTOTYPE, VF_TIMETABLE_STARTED, VF_AUTOFILL_TIMETABLE, VF_AUTOFILL_PRES_WAIT_TIME }

## Functions

const SaveLoad * | GetVehicleDescription (VehicleType vt)
| Make it possible to make the saveload tables "friends" of other classes.
bool | LoadOldVehicle (LoadgameState *ls, int num)
bool | AfterLoadGame ()
void | FixOldVehicles ()

## Variables

VehiclePool | _vehicle_pool
static const int32 | INVALID_COORD = 0x7fffffff

## Detailed Description

Base class for all vehicles.

Definition in file vehicle_base.h.

## Enumeration Type Documentation

enum VehicleFlags

Enumerator:

  VF_TIMETABLE_STARTED | Whether the vehicle has started running on the timetable yet.
  VF_AUTOFILL_TIMETABLE | Whether the vehicle should fill in the timetable automatically.
  VF_AUTOFILL_PRES_WAIT_TIME | Whether non-destructive auto-fill should preserve waiting times.

Definition at line 36 of file vehicle_base.h.

## Function Documentation

const SaveLoad* GetVehicleDescription | ( | VehicleType | vt | ) |

Make it possible to make the saveload tables "friends" of other classes.

Parameters:

  | vt | the vehicle type. Can be VEH_END for the common vehicle description data

Returns:
  the saveload description

So we can use private/protected variables in the saveload code.

Saving and loading the current order of vehicles.

The vehicles have a cargo list (and we want that saved).

Parameters:

  | vt | the vehicle type. Can be VEH_END for the common vehicle description data

Returns:
  the saveload description

Save and load of vehicles

Save and load of vehicles

Definition at line 402 of file vehicle_sl.cpp.

References VEH_AIRCRAFT, VEH_DISASTER, VEH_EFFECT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.

Referenced by Load_VEHS(), and Save_VEHS().