OpenTTD Source
20241108-master-g80f628063a
|
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... | |
std::string | 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 | ResetOldWaypoints () |
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... | |
void | AfterLoadVehiclesPhase1 (bool part_of_load) |
Called after load for phase 1 of vehicle initialisation. More... | |
void | AfterLoadVehiclesPhase2 (bool part_of_load) |
Called after load for phase 2 of vehicle initialisation. | |
void | FixupTrainLengths () |
Fixup old train spacing. | |
void | AfterLoadStations () |
void | AfterLoadRoadStops () |
(Re)building of road stop caches after loading a savegame. | |
void | ResetLabelMaps () |
void | AfterLoadLabelMaps () |
Perform rail type and road type conversion if necessary. | |
void | AfterLoadStoryBook () |
Called after load to trash broken pages. | |
void | AfterLoadLinkGraphs () |
Spawn the threads for running link graph calculations. More... | |
void | AfterLoadCompanyStats () |
Rebuilding of company statistics after loading a savegame. | |
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. | |
void | ResetTempEngineData () |
Engine * | GetTempDataEngine (EngineID index) |
void | CopyTempEngineData () |
Copy data from temporary engine array into the real engine pool. | |
CompanyManagerFace | ConvertFromOldCompanyManagerFace (uint32_t face) |
Converts an old company manager's face format to the new company manager's face format. More... | |
Order | UnpackOldOrder (uint16_t packed) |
Unpacks a order from savegames made with TTD(Patch) More... | |
Variables | |
int32_t | _saved_scrollpos_x |
int32_t | _saved_scrollpos_y |
ZoomLevel | _saved_scrollpos_zoom |
SavegameType | _savegame_type |
type of savegame we are loading | |
uint32_t | _ttdp_version |
version of TTDP savegame (if applicable) | |
Declaration of functions used in more save/load files.
Definition in file saveload_internal.h.
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 232 of file linkgraph_sl.cpp.
References _network_server, _networking, AfterLoad_LinkGraphPauseControl(), SpecializedStation< Station, false >::GetIfValid(), LinkGraphJob::Graph(), LinkGraphSchedule::instance, IsSavegameVersionBefore(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_job_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_link_graph_pool >::Iterate(), LinkGraph::Size(), SLV_191, LinkGraphSchedule::SpawnAll(), and BaseStation::xy.
void AfterLoadVehiclesPhase1 | ( | bool | part_of_load | ) |
Called after load for phase 1 of vehicle initialisation.
So we can set the #previous and #first pointers while loading.
For instantiating the shared vehicle chain.
Definition at line 255 of file vehicle_sl.cpp.
CompanyManagerFace ConvertFromOldCompanyManagerFace | ( | uint32_t | 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 45 of file company_sl.cpp.
References ClampU(), ETHNICITY_BLACK, GB(), GE_WF, GE_WM, GENDER_FEMALE, HasBit(), ScaleCompanyManagerFaceValue(), SetBit(), and SetCompanyManagerFaceBits().
std::string 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 61 of file strings_sl.cpp.
References GetStringTab().
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 45 of file station_sl.cpp.
References BaseStation::build_date, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), BaseStation::delete_ctr, GetStationIndex(), GetTileOwner(), HVOT_WAYPOINT, INVALID_TILE, IsInsideBS(), IsTileType(), SpecializedStation< Station, false >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_vehicle_pool >::Iterate(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_orderlist_pool >::Iterate(), Tile::m6(), MP_STATION, BaseStation::name, Town::name, Order::next, BaseStation::owner, OWNER_NONE, SB(), BaseStation::string_id, BaseStation::town, Waypoint::town_cn, 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 67 of file waypoint_sl.cpp.
References _old_waypoints, AllocateSpecToStation(), BaseStation::build_date, Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_station_pool >::CanAllocateItem(), Debug, BaseStation::delete_ctr, FACIL_TRAIN, BaseStation::facilities, GB(), NewGRFClass< Tspec, Tindex, Tmax >::Get(), GetRailTileType(), GetRailType(), NewGRFClass< Tspec, Tindex, Tmax >::GetSpec(), GetTileOwner(), StationSpec::grf_prop, GRFFilePropsBase< Tcnt >::grffile, HasBit(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem< Tpool >::index, IsSavegameVersionBefore(), IsTileType(), 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(), GRFFilePropsBase< Tcnt >::local_id, Tile::m2(), Tile::m3(), Tile::m4(), Tile::m5(), MakeRailWaypoint(), MP_RAILWAY, BaseStation::name, Order::next, BaseStation::owner, BaseStation::rect, SetCustomStationSpecIndex(), SetRailStationReservation(), Map::Size(), SlError(), SlErrorCorrupt(), SLV_100, SLV_17, NewGRFClass< Tspec, Tindex, Tmax >::Specs(), STAT_CLASS_WAYP, BaseStation::string_id, BaseStation::town, Waypoint::town_cn, UpdateWaypointOrder(), and VEH_TRAIN.
Remap a string ID from the old format to the new format.
s | StringID that requires remapping |
Definition at line 30 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 102 of file strings_sl.cpp.
References _old_name_array, and free().
Order UnpackOldOrder | ( | uint16_t | packed | ) |
Unpacks a order from savegames made with TTD(Patch)
packed | packed order |
Definition at line 92 of file order_sl.cpp.
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 HouseSpec::Get(), GetCleanHouseType(), IsTileType(), MP_HOUSE, NEW_HOUSE_OFFSET, and Map::Size().