A vehicle is one of the fundamental entities in the game.
There are 6 recognised vehicle types in the VehicleType enum:
- VEH_TRAIN: A train or carriage. Makes use of a linked list for the carriages.
- VEH_ROAD: A bus or truck. Will probably use the same linked list for articulated vehicles.
The Vehicle struct has many variables and methods. Some of the important ones are:
|VehicleTypeByte type||The vehicle type|
|PlayerByte owner||owner of the vehicle|
| TileIndex tile
| Its current location|
x_pos and y_pos are world coordinates in 1/16th of a tile.
| byte spritenum
|TextEffectID fill_percent_te_id||a text-effect id to a loading indicator object|
| uint16 max_speed
|Speed of the train|
| byte acceleration
|Acceleration and max speed|
| CargoID cargo_type
|Type and amount of cargo|
|Order *orders||Linked list of orders|
|Entering and leaving a station|
There are many more methods and variables than this. For more info, see vehicle_base.h and vehicle.cpp. Vehicles are all subclassed, so there are other more specific methods and variables for trains, etc.