vehicle_sl.cpp File Reference

Code handling saving and loading of vehicles. More...

#include "../stdafx.h"
#include "../vehicle_func.h"
#include "../train.h"
#include "../roadveh.h"
#include "../ship.h"
#include "../aircraft.h"
#include "../effectvehicle_base.h"
#include "saveload.h"
#include <map>

Go to the source code of this file.

Functions

void ConnectMultiheadedTrains ()
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.
void AfterLoadVehicles (bool part_of_load)
 Called after load to update coordinates.
const SaveLoadGetVehicleDescription (VehicleType vt)
 Make it possible to make the saveload tables "friends" of other classes.
static void Save_VEHS ()
 Will be called when the vehicles need to be saved.
void Load_VEHS ()
 Will be called when vehicles need to be loaded.

Variables

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 ChunkHandler _veh_chunk_handlers []


Detailed Description

Code handling saving and loading of vehicles.

Definition in file vehicle_sl.cpp.


Function Documentation

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 240 of file vehicle_sl.cpp.

References AIR_HELICOPTER, CheckSavegameVersion(), CheckSavegameVersionOldStyle(), CheckValidVehicles(), EF_ROAD_TRAM, HasBit(), IsFreeWagon(), IsFrontEngine(), IsNormalAircraft(), IsTrainEngine(), ROADTYPE_ROAD, ROADTYPE_TRAM, RoadTypeToRoadTypes(), TrainConsistChanged(), UpdateAircraftCache(), and VehicleMove().

Referenced by ReloadNewGRFData().

static void CheckValidVehicles (  )  [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 209 of file vehicle_sl.cpp.

Referenced by AfterLoadVehicles().

const SaveLoad* GetVehicleDescription ( VehicleType  vt  ) 

Make it possible to make the saveload tables "friends" of other classes.

So we can use private/protected variables in the saveload code.

Saving and loading the current order of vehicles.

Parameters:
vt the vehicle type. Can be VEH_END for the common vehicle description data
Returns:
the saveload description

Save and load of vehicles

Definition at line 392 of file vehicle_sl.cpp.

Referenced by Load_VEHS(), and Save_VEHS().

void Load_VEHS (  ) 

static void Save_VEHS (  )  [static]

Will be called when the vehicles need to be saved.

Definition at line 673 of file vehicle_sl.cpp.

References GetVehicleDescription(), and SlObject().


Variable Documentation

const ChunkHandler _veh_chunk_handlers[]

Initial value:

 {
  { 'VEHS', Save_VEHS, Load_VEHS, CH_SPARSE_ARRAY | CH_LAST},
}


Generated on Thu Sep 24 19:35:15 2009 for OpenTTD by  doxygen 1.5.6