OpenTTD
|
Declaration of functions used in more save/load files. More...
#include "../company_manager_face.h"
#include "../order_base.h"
#include "../engine_type.h"
#include "saveload.h"
Go to the source code of this file.
Functions | |
void | InitializeOldNames () |
Initialize the old names table memory. | |
StringID | RemapOldStringID (StringID s) |
Remap a string ID from the old format to the new format. More... | |
char * | CopyFromOldName (StringID id) |
Copy and convert old custom names to UTF-8. More... | |
void | ResetOldNames () |
Free the memory of the old names array. More... | |
void | MoveBuoysToWaypoints () |
Perform all steps to upgrade from the old station buoys to the new version that uses waypoints. More... | |
void | MoveWaypointsToBaseStations () |
Perform all steps to upgrade from the old waypoints to the new version that uses station. More... | |
const SaveLoad * | GetBaseStationDescription () |
Get the base station description to be used for SL_ST_INCLUDE. More... | |
void | AfterLoadVehicles (bool part_of_load) |
Called after load to update coordinates. More... | |
void | FixupTrainLengths () |
Fixup old train spacing. More... | |
void | AfterLoadStations () |
void | AfterLoadRoadStops () |
(Re)building of road stop caches after loading a savegame. | |
void | AfterLoadLabelMaps () |
void | AfterLoadStoryBook () |
Called after load to trash broken pages. More... | |
void | AfterLoadLinkGraphs () |
Spawn the threads for running link graph calculations. More... | |
void | AfterLoadCompanyStats () |
Rebuilding of company statistics after loading a savegame. More... | |
void | UpdateHousesAndTowns () |
Check and update town and house values. More... | |
void | UpdateOldAircraft () |
need to be called to load aircraft from old version | |
void | SaveViewportBeforeSaveGame () |
void | ResetViewportAfterLoadGame () |
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 | ConnectMultiheadedTrains () |
Link front and rear multiheaded engines to each other This is done when loading a savegame. | |
Engine * | GetTempDataEngine (EngineID index) |
void | CopyTempEngineData () |
Copy data from temporary engine array into the real engine pool. | |
CompanyManagerFace | ConvertFromOldCompanyManagerFace (uint32 face) |
Converts an old company manager's face format to the new company manager's face format. More... | |
Order | UnpackOldOrder (uint16 packed) |
Unpacks a order from savegames made with TTD(Patch) More... | |
Variables | |
int32 | _saved_scrollpos_x |
int32 | _saved_scrollpos_y |
ZoomLevel | _saved_scrollpos_zoom |
SavegameType | _savegame_type |
type of savegame we are loading | |
uint32 | _ttdp_version |
version of TTDP savegame (if applicable) | |
Declaration of functions used in more save/load files.
Definition in file saveload_internal.h.
void AfterLoadCompanyStats | ( | ) |
Rebuilding of company statistics after loading a savegame.
Definition at line 94 of file company_sl.cpp.
References CountBits(), FACIL_AIRPORT, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Get(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::GetIfValid(), GetPresentSignals(), GetRailType(), GetTileOwner(), GetTileType(), GetTrackBits(), HasSignals(), Company::infrastructure, IsLevelCrossing(), IsPlainRail(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), SpecializedStation< Station, false >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::Iterate(), LEVELCROSSING_TRACKBIT_FACTOR, MapSize(), MemSetT(), MP_RAILWAY, MP_ROAD, CompanyInfrastructure::rail, CompanyInfrastructure::signal, and TracksOverlap().
void AfterLoadLinkGraphs | ( | ) |
Spawn the threads for running link graph calculations.
Has to be done after loading as the cargo classes might have changed.
Definition at line 228 of file linkgraph_sl.cpp.
References SpecializedStation< Station, false >::GetIfValid(), LinkGraphSchedule::instance, IsSavegameVersionBefore(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_job_pool >::Iterate(), LinkGraph::Size(), SLV_191, LinkGraphSchedule::SpawnAll(), and BaseStation::xy.
void AfterLoadStoryBook | ( | ) |
Called after load to trash broken pages.
Definition at line 18 of file story_sl.cpp.
References IsSavegameVersionBefore(), and SLV_185.
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.
CompanyManagerFace ConvertFromOldCompanyManagerFace | ( | uint32 | face | ) |
Converts an old company manager's face format to the new company manager's face format.
Meaning of the bits in the old face (some bits are used in several times):
face | the face in the old format |
Definition at line 43 of file company_sl.cpp.
References ClampU(), ETHNICITY_BLACK, GB(), GE_WF, GE_WM, GENDER_FEMALE, HasBit(), max(), ScaleCompanyManagerFaceValue(), SetBit(), and SetCompanyManagerFaceBits().
char* CopyFromOldName | ( | StringID | id | ) |
Copy and convert old custom names to UTF-8.
They were all stored in a 512 by 32 (200 by 24 for TTO) long string array and are now stored with stations, waypoints and other places with names.
id | the StringID of the custom name to clone. |
Definition at line 59 of file strings_sl.cpp.
References GetStringTab().
Referenced by FixOldVehicles().
void FixupTrainLengths | ( | ) |
Fixup old train spacing.
Definition at line 483 of file vehicle_sl.cpp.
References SpecializedVehicle< Train, Type >::From(), Train::IsPrimaryVehicle(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), SpecializedVehicle< T, Type >::Next(), TFP_SIGNAL, TRACK_BIT_DEPOT, TrainController(), BaseVehicle::type, VEH_TRAIN, VEHICLE_LENGTH, and VS_CRASHED.
const SaveLoad* GetBaseStationDescription | ( | ) |
Get the base station description to be used for SL_ST_INCLUDE.
Definition at line 465 of file station_sl.cpp.
void MoveBuoysToWaypoints | ( | ) |
Perform all steps to upgrade from the old station buoys to the new version that uses waypoints.
This includes some old saveload mechanics.
Definition at line 40 of file station_sl.cpp.
References HVOT_WAYPOINT, INVALID_TILE, SpecializedStation< Station, false >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_orderlist_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), Town::name, Order::next, UpdateWaypointOrder(), VEH_SHIP, and VEH_TRAIN.
void MoveWaypointsToBaseStations | ( | ) |
Perform all steps to upgrade from the old waypoints to the new version that uses station.
This includes some old saveload mechanics.
Definition at line 65 of file waypoint_sl.cpp.
References _m, _old_waypoints, IsSavegameVersionBefore(), Tile::m2, and SLV_17.
Remap a string ID from the old format to the new format.
s | StringID that requires remapping |
Definition at line 28 of file strings_sl.cpp.
void ResetOldNames | ( | ) |
Free the memory of the old names array.
Should be called once the old names have all been converted.
Definition at line 107 of file strings_sl.cpp.
References _old_name_array, and free().
Order UnpackOldOrder | ( | uint16 | packed | ) |
Unpacks a order from savegames made with TTD(Patch)
packed | packed order |
Definition at line 89 of file order_sl.cpp.
References Order::IsType(), and UnpackVersion4Order().
void UpdateHousesAndTowns | ( | ) |
Check and update town and house values.
Checked are the HouseIDs. Updated are the town population the number of houses per town, the town radius and the max passengers of the town.
Definition at line 64 of file town_sl.cpp.
References GetCleanHouseType(), IsTileType(), MapSize(), MP_HOUSE, and NEW_HOUSE_OFFSET.