#include "vehicle_type.h"
#include "track_type.h"
#include "rail_type.h"
#include "road_type.h"
#include "cargo_type.h"
#include "direction_type.h"
#include "gfx_type.h"
#include "command_type.h"
#include "date_type.h"
#include "company_base.h"
#include "company_type.h"
#include "oldpool.h"
#include "order_base.h"
#include "cargopacket.h"
#include "texteff.hpp"
#include "group_type.h"
#include "engine_type.h"
#include "order_func.h"
#include "transport_type.h"
Go to the source code of this file.
Data Structures | |
struct | VehicleRail |
struct | VehicleAir |
struct | VehicleRoad |
struct | VehicleEffect |
struct | VehicleDisaster |
struct | VehicleShip |
struct | Vehicle |
struct | DisasterVehicle |
This class 'wraps' Vehicle; you do not actually instantiate this class. More... | |
struct | InvalidVehicle |
This class 'wraps' Vehicle; you do not actually instantiate this class. More... | |
struct | FreeUnitIDGenerator |
Generates sequence of free UnitID numbers. More... | |
Defines | |
#define | FOR_ALL_VEHICLES_FROM(v, start) for (v = GetVehicle(start); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) if (v->IsValid()) |
#define | FOR_ALL_VEHICLES(v) FOR_ALL_VEHICLES_FROM(v, 0) |
Enumerations | |
enum | RoadVehicleStates { RVSB_IN_DEPOT = 0xFE, RVSB_WORMHOLE = 0xFF, RVS_USING_SECOND_BAY = 1, RVS_IS_STOPPING = 2, RVS_DRIVE_SIDE = 4, RVS_IN_ROAD_STOP = 5, RVS_IN_DT_ROAD_STOP = 6, RVSB_IN_ROAD_STOP = 1 << RVS_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END = RVSB_IN_ROAD_STOP + TRACKDIR_END, RVSB_IN_DT_ROAD_STOP = 1 << RVS_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END, RVSB_TRACKDIR_MASK = 0x0F, RVSB_ROAD_STOP_TRACKDIR_MASK = 0x09 } |
Road vehicle states. More... | |
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 } |
enum | VehicleRailFlags { VRF_REVERSING = 0, VRF_GOINGUP = 1, VRF_GOINGDOWN = 2, VRF_POWEREDWAGON = 3, VRF_REVERSE_DIRECTION = 4, VRF_NO_PATH_TO_DESTINATION = 5, VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6, VRF_TOGGLE_REVERSE = 7, VRF_TRAIN_STUCK = 8 } |
Functions | |
const SaveLoad * | GetVehicleDescription (VehicleType vt) |
Make it possible to make the saveload tables "friends" of other classes. | |
bool | LoadOldVehicle (LoadgameState *ls, int num) |
static VehicleID | GetMaxVehicleIndex () |
static uint | GetNumVehicles () |
static bool | IsValidVehicleID (uint index) |
Check if an index is a vehicle-index (so between 0 and max-vehicles). | |
static Order * | GetVehicleOrder (const Vehicle *v, int index) |
static Order * | GetLastVehicleOrder (const Vehicle *v) |
Returns the last order of a vehicle, or NULL if it doesn't exists. | |
Trackdir | GetVehicleTrackdir (const Vehicle *v) |
Returns the Trackdir on which the vehicle is currently located. | |
void | CheckVehicle32Day (Vehicle *v) |
Variables | |
static const int32 | INVALID_COORD = 0x7fffffff |
Definition in file vehicle_base.h.
enum RoadVehicleStates |
Road vehicle states.
Definition at line 29 of file vehicle_base.h.
enum VehicleFlags |
Definition at line 74 of file vehicle_base.h.
static Order* GetLastVehicleOrder | ( | const Vehicle * | v | ) | [inline, static] |
Returns the last order of a vehicle, or NULL if it doesn't exists.
v | Vehicle to query |
Definition at line 703 of file vehicle_base.h.
Referenced by CheckOrders().
const SaveLoad* GetVehicleDescription | ( | VehicleType | vt | ) |
Make it possible to make the saveload tables "friends" of other classes.
vt | the vehicle type. Can be VEH_END for the common vehicle description data |
Saving and loading the current order of vehicles.
vt | the vehicle type. Can be VEH_END for the common vehicle description data |
Save and load of vehicles
Definition at line 380 of file vehicle_sl.cpp.
Referenced by Load_VEHS(), and Save_VEHS().
Trackdir GetVehicleTrackdir | ( | const Vehicle * | v | ) |
Returns the Trackdir on which the vehicle is currently located.
Works for trains and ships. Currently works only sortof for road vehicles, since they have a fuzzy concept of being "on" a trackdir. Dunno really what it returns for a road vehicle that is halfway a tile, never really understood that part. For road vehicles that are at the beginning or end of the tile, should just return the diagonal trackdir on which they are driving. I _think_. For other vehicles types, or vehicles with no clear trackdir (such as those in depots), returns 0xFF.
Definition at line 1728 of file vehicle.cpp.
References DiagDirToDiagTrackdir(), DirToDiagDir(), FindFirstTrack(), GetRailDepotDirection(), GetRoadStopDir(), INVALID_TRACKDIR, IsReversingRoadTrackdir(), TRACK_BIT_DEPOT, TRACK_BIT_WORMHOLE, and TrackDirectionToTrackdir().
Referenced by CheckNextTrainTile(), ChooseShipTrack(), CmdBuildRailroadStation(), CmdRemoveFromRailroadStation(), FindClosestTrainDepot(), FollowTrainReservation(), FreeTrainTrackReservation(), YapfCheckReverseTrain(), YapfFindNearestRailDepotTwoWay(), and YapfFindNearestRoadDepot().
static bool IsValidVehicleID | ( | uint | index | ) | [inline, static] |
Check if an index is a vehicle-index (so between 0 and max-vehicles).
index | of the vehicle to query |
Definition at line 668 of file vehicle_base.h.
Referenced by CmdAddVehicleGroup(), CmdAutofillTimetable(), CmdAutoreplaceVehicle(), CmdChangeServiceInt(), CmdChangeTimetable(), CmdCloneOrder(), CmdCloneVehicle(), CmdDeleteOrder(), CmdForceTrainProceed(), CmdInsertOrder(), CmdModifyOrder(), CmdMoveOrder(), CmdMoveRailVehicle(), CmdOrderRefit(), CmdRefitAircraft(), CmdRefitRailVehicle(), CmdRefitRoadVeh(), CmdRefitShip(), CmdRenameVehicle(), CmdRestoreOrderIndex(), CmdReverseTrainDirection(), CmdSellAircraft(), CmdSellRailWagon(), CmdSellRoadVeh(), CmdSellShip(), CmdSendAircraftToHangar(), CmdSendRoadVehToDepot(), CmdSendShipToDepot(), CmdSendTrainToDepot(), CmdSetVehicleOnTime(), CmdSkipToOrder(), CmdStartStopVehicle(), CmdTurnRoadVeh(), and AIVehicle::IsValidVehicle().