|
OpenTTD Source
12.2
|
#include "../stdafx.h"#include "saveload.h"#include "compat/vehicle_sl_compat.h"#include "../vehicle_func.h"#include "../train.h"#include "../roadveh.h"#include "../ship.h"#include "../aircraft.h"#include "../station_base.h"#include "../effectvehicle_base.h"#include "../company_base.h"#include "../company_func.h"#include "../disaster_vehicle.h"#include <map>#include "../safeguards.h"Go to the source code of this file.
Data Structures | |
| class | SlVehicleCommon |
| class | SlVehicleTrain |
| class | SlVehicleRoadVeh |
| class | SlVehicleShip |
| class | SlVehicleAircraft |
| class | SlVehicleEffect |
| class | SlVehicleDisaster |
| struct | VEHSChunkHandler |
Functions | |
| void | ConnectMultiheadedTrains () |
| Link front and rear multiheaded engines to each other This is done when loading a savegame. | |
| void | ConvertOldMultiheadToNew () |
| Converts all trains to the new subtype format introduced in savegame 16.2 It also links multiheaded engines or make them forget they are multiheaded if no suitable partner is found. | |
| void | UpdateOldAircraft () |
| need to be called to load aircraft from old version | |
| static void | CheckValidVehicles () |
| Check all vehicles to ensure their engine type is valid for the currently loaded NewGRFs (that includes none...) This only makes a difference if NewGRFs are missing, otherwise all vehicles will be valid. More... | |
| void | AfterLoadVehicles (bool part_of_load) |
| Called after load to update coordinates. More... | |
| bool | TrainController (Train *v, Vehicle *nomove, bool reverse=true) |
| Move a vehicle chain one movement stop forwards. More... | |
| void | ReverseTrainDirection (Train *v) |
| Turn a train around. More... | |
| void | ReverseTrainSwapVeh (Train *v, int l, int r) |
| Swap vehicles l and r in consist v, and reverse their direction. More... | |
| void | FixupTrainLengths () |
| Fixup old train spacing. | |
Variables | |
| byte | _age_cargo_skip_counter |
| Skip aging of cargo? Used before savegame version 162. | |
| static uint8 | _cargo_days |
| static uint16 | _cargo_source |
| static uint32 | _cargo_source_xy |
| static uint16 | _cargo_count |
| static uint16 | _cargo_paid_for |
| static Money | _cargo_feeder_share |
| static uint32 | _cargo_loaded_at_xy |
| const static SaveLoad | _vehicle_desc [] |
| static const VEHSChunkHandler | VEHS |
| static const ChunkHandlerRef | veh_chunk_handlers [] |
| const ChunkHandlerTable | _veh_chunk_handlers (veh_chunk_handlers) |
Code handling saving and loading of vehicles
Definition in file vehicle_sl.cpp.
| void AfterLoadVehicles | ( | bool | part_of_load | ) |
Called after load to update coordinates.
So we can set the #previous and #first pointers while loading.
For instantiating the shared vehicle chain.
Definition at line 242 of file vehicle_sl.cpp.
|
static |
Check all vehicles to ensure their engine type is valid for the currently loaded NewGRFs (that includes none...) This only makes a difference if NewGRFs are missing, otherwise all vehicles will be valid.
This does not make such a game playable, it only prevents crash.
Definition at line 211 of file vehicle_sl.cpp.
References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_engine_pool >::GetPoolSize(), INVALID_ENGINE, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), Engine::IterateType(), VEH_AIRCRAFT, VEH_ROAD, VEH_SHIP, and VEH_TRAIN.
| void ReverseTrainDirection | ( | Train * | v | ) |
Turn a train around.
| v | Train to turn around. |
Definition at line 1824 of file train_cmd.cpp.
References IsRailDepotTile(), and Vehicle::tile.
| void ReverseTrainSwapVeh | ( | Train * | v, |
| int | l, | ||
| int | r | ||
| ) |
Swap vehicles l and r in consist v, and reverse their direction.
| v | Consist to change. |
| l | Vehicle index in the consist of the first vehicle. |
| r | Vehicle index in the consist of the second vehicle. |
Definition at line 1597 of file train_cmd.cpp.
References Vehicle::direction, GroundVehicle< T, Type >::gv_flags, SpecializedVehicle< T, Type >::Next(), Swap(), SwapTrainFlags(), Vehicle::tile, UpdateStatusAfterSwap(), Vehicle::vehstatus, VS_HIDDEN, Vehicle::x_pos, Vehicle::y_pos, and Vehicle::z_pos.
Move a vehicle chain one movement stop forwards.
| v | First vehicle to move. |
| nomove | Stop moving this and all following vehicles. |
| reverse | Set to false to not execute the vehicle reversing. This does not change any other logic. |
Definition at line 3115 of file train_cmd.cpp.
References DIAGDIR_BEGIN, DiagdirBetweenTiles(), DiagdirReachesTrackdirs(), FindFirstTrack(), SpecializedVehicle< T, Type >::First(), GetNewVehiclePos(), GetTileRailType(), GetTileTrackStatus(), HasBit(), Vehicle::IsFrontEngine(), IsValidDiagDirection(), GetNewVehiclePosResult::new_tile, SpecializedVehicle< T, Type >::Next(), GetNewVehiclePosResult::old_tile, SpecializedVehicle< T, Type >::Previous(), Rail90DegTurnDisallowed(), ReverseDiagDir(), TRACK_BIT_DEPOT, TRACK_BIT_NONE, TRACK_BIT_WORMHOLE, TrackCrossesTracks(), TrackdirBitsToTrackBits(), TrackStatusToRedSignals(), TrackStatusToTrackdirBits(), TrainCheckIfLineEnds(), TrainEnterStation(), TRANSPORT_RAIL, VehicleEnterTile(), VETS_CANNOT_ENTER, VETS_ENTERED_STATION, VETS_STATION_ID_OFFSET, Vehicle::x_pos, GetNewVehiclePosResult::y, and Vehicle::y_pos.
Referenced by AdvanceWagonsAfterSwap(), and FixupTrainLengths().
|
static |
Definition at line 987 of file vehicle_sl.cpp.
|
static |
Definition at line 1070 of file vehicle_sl.cpp.