#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 "window_type.h"
#include "gfx_type.h"
#include "command_type.h"
#include "date_type.h"
#include "player_type.h"
#include "oldpool.h"
#include "order.h"
#include "cargopacket.h"
#include "texteff.hpp"
Go to the source code of this file.
Data Structures | |
struct | VehicleRail |
struct | VehicleAir |
struct | VehicleRoad |
struct | VehicleSpecial |
struct | VehicleDisaster |
struct | VehicleShip |
struct | Vehicle |
struct | SpecialVehicle |
This class 'wraps' Vehicle; you do not actually instantiate this class. More... | |
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... | |
Defines | |
#define | BEGIN_ENUM_WAGONS(v) do { |
#define | END_ENUM_WAGONS(v) } while ((v = v->Next()) != NULL); |
#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 } |
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 } |
Functions | |
const SaveLoad * | GetVehicleDescription (VehicleType vt) |
Make it possible to make the saveload tables "friends" of other classes. | |
void | AfterLoadVehicles (bool clear_te_id) |
Called after load to update coordinates. | |
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. | |
static Vehicle * | GetFirstVehicleFromSharedList (const Vehicle *v) |
Get the first vehicle of a shared-list, so we only have to walk forwards. | |
Trackdir | GetVehicleTrackdir (const Vehicle *v) |
Returns the Trackdir on which the vehicle is currently located. | |
void | CheckVehicle32Day (Vehicle *v) |
Definition in file vehicle_base.h.
enum RoadVehicleStates |
Road vehicle states.
Definition at line 25 of file vehicle_base.h.
enum VehicleFlags |
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. |
Definition at line 70 of file vehicle_base.h.
static Vehicle* GetFirstVehicleFromSharedList | ( | const Vehicle * | v | ) | [inline, static] |
Get the first vehicle of a shared-list, so we only have to walk forwards.
v | Vehicle to query |
Definition at line 637 of file vehicle_base.h.
Referenced by CmdAddSharedVehicleGroup(), CmdAutofillTimetable(), CmdCloneOrder(), CmdDeleteOrder(), CmdInsertOrder(), CmdModifyOrder(), CmdMoveOrder(), CmdOrderRefit(), GenerateVehicleSortList(), and RemoveOrderFromAllVehicles().
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 621 of file vehicle_base.h.
Referenced by CheckOrders(), and CmdInsertOrder().
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 |
Save and load of vehicles
Definition at line 2834 of file vehicle.cpp.
References GetVehicleDescription().
Referenced by GetVehicleDescription(), 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 2536 of file vehicle.cpp.
References DiagdirToDiagTrackdir(), DirToDiagDir(), FindFirstTrack(), GetRailDepotDirection(), GetRoadStopDir(), INVALID_TRACKDIR, IsReversingRoadTrackdir(), TRACK_BIT_DEPOT, TRACK_BIT_WORMHOLE, and TrackDirectionToTrackdir().
Referenced by ChooseShipTrack(), FindClosestTrainDepot(), 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 598 of file vehicle_base.h.
Referenced by CmdAddVehicleGroup(), CmdAutofillTimetable(), CmdChangeServiceInt(), CmdChangeTimetable(), CmdCloneOrder(), CmdCloneVehicle(), CmdDeleteOrder(), CmdForceTrainProceed(), CmdInsertOrder(), CmdModifyOrder(), CmdMoveOrder(), CmdMoveRailVehicle(), CmdNameVehicle(), CmdOrderRefit(), CmdRefitAircraft(), CmdRefitRailVehicle(), CmdRefitRoadVeh(), CmdRefitShip(), CmdRestoreOrderIndex(), CmdReverseTrainDirection(), CmdSellAircraft(), CmdSellRailWagon(), CmdSellRoadVeh(), CmdSellShip(), CmdSendAircraftToHangar(), CmdSendRoadVehToDepot(), CmdSendShipToDepot(), CmdSendTrainToDepot(), CmdSetVehicleOnTime(), CmdSkipToOrder(), CmdStartStopAircraft(), CmdStartStopRoadVeh(), CmdStartStopShip(), CmdStartStopTrain(), and CmdTurnRoadVeh().