OpenTTDDevBlackBook/Simulation/Vehicles
Audio
Music
Graphic
Using the Window System
Colour codes that exist in OpenTTD
Adding a text box
Understanding the widget focus system
Add a setting
Add a squirrel function
Do a savegame BUMP
Understanding the Dynamic Landscape Array
Understanding the SaveGame Handler
HOWTO - Create good Scenarios
HOWTO - Add New Town Name Generators
Vehicles
Using Orders
Pathfinding
Ratings
Train Acceleration
Format of langfiles
Using OpenTTD Strings
List of Special Strings
The OpenTTD TCP Protocol
The OpenTTD UDP Protocol
HOWTO - Debug desyncs
The Console Window
Using Console Scripting
HOWTO - Add Functions/Commands to the Console
HOWTO - Add Variables to the Console
HOWTO - Direct Variable Access using ICONSOLE_VAR_POINTER
OpenTTD Console Commands
OpenTTD Console Variables
Development History
A vehicle is one of the fundamental entities in the game.
Types
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.
- VEH_SHIP
- VEH_AIRCRAFT
- VEH_SPECIAL
- VEH_DISASTER
Vehicle
The Vehicle struct has many variables and methods. Some of the important ones are:
Variables | |
VehicleTypeByte type | The vehicle type |
PlayerByte owner | owner of the vehicle |
TileIndex tile int32 x_pos int32 y_pos byte z_pos |
Its current location x_pos and y_pos are world coordinates in 1/16th of a tile. |
byte spritenum uint16 cur_image byte sprite_width byte sprite_height |
Sprite infomation |
TextEffectID fill_percent_te_id | a text-effect id to a loading indicator object |
uint16 max_speed byte subspeed |
Speed of the train |
byte acceleration uint16 max_speed |
Acceleration and max speed |
byte vehstatus | Status |
CargoID cargo_type uint16 cargo_cap |
Type and amount of cargo |
Order *orders | Linked list of orders |
Methods | |
BeginLoading() LeaveStation() |
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.