OpenTTD Source 20241224-master-gf74b0cf984
|
Base class for all vehicles. More...
#include "track_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"
#include "group_type.h"
#include "base_consist.h"
#include "network/network.h"
#include "saveload/saveload.h"
#include "timer/timer_game_calendar.h"
#include "core/mem_func.hpp"
Go to the source code of this file.
Data Structures | |
struct | NewGRFCache |
Cached often queried (NewGRF) values. More... | |
struct | VehicleCache |
Cached often queried values common to all vehicles. More... | |
struct | VehicleSpriteSeq |
Sprite sequence for a vehicle part. More... | |
struct | MutableSpriteCache |
Cache for vehicle sprites and values relating to whether they should be updated before drawing, or calculating the viewport. More... | |
struct | RefitDesc |
Simulated cargo type and capacity for prediction of future links. More... | |
struct | ClosestDepot |
Structure to return information about the closest depot location, and whether it could be found. More... | |
struct | Vehicle |
Vehicle data structure. More... | |
struct | Vehicle::OrderIterator |
Iterator to iterate orders Supports deletion of current order. More... | |
struct | Vehicle::IterateWrapper |
Iterable ensemble of orders. More... | |
struct | SpecializedVehicle< T, Type > |
Class defining several overloaded accessors so we don't have to cast vehicle types that often. More... | |
Typedefs | |
typedef Pool< Vehicle, VehicleID, 512, 0xFF000 > | VehiclePool |
A vehicle pool for a little over 1 million vehicles. | |
Functions | |
bool | LoadOldVehicle (LoadgameState *ls, int num) |
Load the vehicles of an old style savegame. | |
void | FixOldVehicles () |
Convert the old style vehicles into something that resembles the old new style savegames. | |
Variables | |
const uint | TILE_AXIAL_DISTANCE = 192 |
const uint | TILE_CORNER_DISTANCE = 128 |
VehiclePool | _vehicle_pool |
static const int32_t | INVALID_COORD = 0x7fffffff |
Sentinel for an invalid coordinate. | |
Base class for all vehicles.
Definition in file vehicle_base.h.
typedef Pool<Vehicle, VehicleID, 512, 0xFF000> VehiclePool |
A vehicle pool for a little over 1 million vehicles.
Definition at line 204 of file vehicle_base.h.
Enum to handle ground vehicle subtypes.
This is defined here instead of at GroundVehicle because some common function require access to these flags. Do not access it directly unless you have to. Use the subtype access functions.
Enumerator | |
---|---|
GVSF_FRONT | Leading engine of a consist. |
GVSF_ARTICULATED_PART | Articulated part of an engine. |
GVSF_WAGON | Wagon (not used for road vehicles). |
GVSF_ENGINE | Engine that can be front engine, but might be placed behind another engine (not used for road vehicles). |
GVSF_FREE_WAGON | First in a wagon chain (in depot) (not used for road vehicles). |
GVSF_MULTIHEADED | Engine is multiheaded (not used for road vehicles). |
Definition at line 115 of file vehicle_base.h.
Bit numbers used to indicate which of the NewGRFCache values are valid.
Definition at line 58 of file vehicle_base.h.
enum VehicleFlags |
Bit numbers in Vehicle::vehicle_flags.
Enumerator | |
---|---|
VF_LOADING_FINISHED | Vehicle has finished loading. |
VF_CARGO_UNLOADING | Vehicle is unloading cargo. |
VF_BUILT_AS_PROTOTYPE | Vehicle is a prototype (accepted as exclusive preview). |
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. |
VF_STOP_LOADING | Don't load anymore during the next load cycle. |
VF_PATHFINDER_LOST | Vehicle's pathfinder is lost. |
VF_SERVINT_IS_CUSTOM | Service interval is custom. |
VF_SERVINT_IS_PERCENT | Service interval is percent. |
Definition at line 44 of file vehicle_base.h.
enum VehStatus |
Vehicle status bits in Vehicle::vehstatus.
Enumerator | |
---|---|
VS_HIDDEN | Vehicle is not visible. |
VS_STOPPED | Vehicle is stopped by the player. |
VS_UNCLICKABLE | Vehicle is not clickable by the user (shadow vehicles). |
VS_DEFPAL | Use default vehicle palette.
|
VS_TRAIN_SLOWING | Train is slowing down. |
VS_SHADOW | Vehicle is a shadow vehicle. |
VS_AIRCRAFT_BROKEN | Aircraft is broken down. |
VS_CRASHED | Vehicle is crashed. |
Definition at line 32 of file vehicle_base.h.
enum VisualEffect |
Meaning of the various bits of the visual effect.
Definition at line 81 of file vehicle_base.h.
Models for spawning visual effects.
Enumerator | |
---|---|
VESM_NONE | No visual effect. |
VESM_STEAM | Steam model. |
VESM_DIESEL | Diesel model. |
VESM_ELECTRIC | Electric model. |
Definition at line 101 of file vehicle_base.h.
|
extern |
Convert the old style vehicles into something that resembles the old new style savegames.
Then AfterLoadGame can handle the rest of the conversion.
Definition at line 256 of file oldloader_sl.cpp.
|
extern |
Load the vehicles of an old style savegame.
ls | State (buffer) of the currently loaded game. |
num | The number of vehicles to load. |
So we can set the proper next pointer while loading.
ls | State (buffer) of the currently loaded game. |
num | The number of vehicles to load. |
Definition at line 258 of file oldloader_sl.cpp.
|
static |
Sentinel for an invalid coordinate.
Definition at line 1288 of file vehicle_base.h.
Referenced by AfterLoadVehiclesPhase2(), Vehicle::UpdateBoundingBoxCoordinates(), Vehicle::UpdateViewport(), Vehicle::Vehicle(), and Vehicle::~Vehicle().
const uint TILE_AXIAL_DISTANCE = 192 |
Definition at line 28 of file vehicle_base.h.
const uint TILE_CORNER_DISTANCE = 128 |
Definition at line 29 of file vehicle_base.h.