Code handling saving and loading of company data. More...
#include "../stdafx.h"
#include "../company_func.h"
#include "../company_manager_face.h"
#include "../fios.h"
#include "../rail_map.h"
#include "../road_map.h"
#include "../station_map.h"
#include "../tunnelbridge_map.h"
#include "../tunnelbridge.h"
#include "../station_base.h"
#include "saveload.h"
#include "table/strings.h"
Go to the source code of this file.
Data Structures | |
struct | CompanyOldAI |
Functions | |
CompanyManagerFace | ConvertFromOldCompanyManagerFace (uint32 face) |
Converts an old company manager's face format to the new company manager's face format. | |
void | AfterLoadCompanyStats () |
Rebuilding of company statistics after loading a savegame. | |
static void | SaveLoad_PLYR_common (Company *c, CompanyProperties *cprops) |
static void | SaveLoad_PLYR (Company *c) |
static void | Save_PLYR () |
static void | Load_PLYR () |
static void | Check_PLYR () |
static void | Ptrs_PLYR () |
Variables | |
static const SaveLoad | _company_desc [] |
static const SaveLoad | _company_settings_desc [] |
static const SaveLoad | _company_settings_skip_desc [] |
static const SaveLoad | _company_economy_desc [] |
static const SaveLoad | _company_ai_desc [] |
static const SaveLoad | _company_ai_build_rec_desc [] |
static const SaveLoad | _company_livery_desc [] |
const ChunkHandler | _company_chunk_handlers [] |
Code handling saving and loading of company data.
Definition in file company_sl.cpp.
void AfterLoadCompanyStats | ( | ) |
Rebuilding of company statistics after loading a savegame.
Definition at line 96 of file company_sl.cpp.
References CountBits(), FACIL_AIRPORT, BaseStation::facilities, FOR_EACH_SET_ROADTYPE, 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(), GetOtherTunnelBridgeEnd(), GetPresentSignals(), GetRailType(), GetRoadBits(), GetRoadOwner(), GetRoadTypes(), GetStationType(), GetTileOwner(), GetTileType(), GetTrackBits(), GetTunnelBridgeLength(), GetTunnelBridgeTransportType(), GetWaterClass(), HasSignals(), Company::infrastructure, IsLevelCrossing(), IsLock(), IsNormalRoad(), IsPlainRail(), IsRoadDepot(), IsShipDepot(), IsStationTileBlocked(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tpool_type, Tcache, Tzero >::PoolItem<&_company_pool >::IsValidID(), LEVELCROSSING_TRACKBIT_FACTOR, LOCK_DEPOT_TILE_FACTOR, MapSize(), MemSetT(), MP_OBJECT, MP_RAILWAY, MP_ROAD, MP_STATION, MP_TUNNELBRIDGE, MP_WATER, BaseStation::owner, CompanyInfrastructure::rail, CompanyInfrastructure::road, CompanyInfrastructure::signal, CompanyInfrastructure::station, TracksOverlap(), TRANSPORT_RAIL, TRANSPORT_ROAD, TRANSPORT_WATER, TUNNELBRIDGE_TRACKBIT_FACTOR, CompanyInfrastructure::water, and WATER_CLASS_CANAL.
Referenced by AfterLoadGame(), CheckCaches(), and ReloadNewGRFData().
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 45 of file company_sl.cpp.
References ClampU(), ETHNICITY_BLACK, GB(), GE_WF, GENDER_FEMALE, HasBit(), max(), ScaleCompanyManagerFaceValue(), SetBit(), and SetCompanyManagerFaceBits().
Referenced by AfterLoadGame().
const SaveLoad _company_ai_build_rec_desc[] [static] |
{ SLE_CONDNULL(2, 0, 5), SLE_CONDNULL(4, 6, 106), SLE_CONDNULL(2, 0, 5), SLE_CONDNULL(4, 6, 106), SLE_CONDNULL(8, 0, 106), }
Definition at line 386 of file company_sl.cpp.
const SaveLoad _company_ai_desc[] [static] |
{ SLE_CONDNULL(2, 0, 106), SLE_CONDNULL(2, 0, 12), SLE_CONDNULL(4, 13, 106), SLE_CONDNULL(8, 0, 106), SLE_CONDVAR(CompanyOldAI, num_build_rec, SLE_UINT8, 0, 106), SLE_CONDNULL(3, 0, 106), SLE_CONDNULL(2, 0, 5), SLE_CONDNULL(4, 6, 106), SLE_CONDNULL(2, 0, 5), SLE_CONDNULL(4, 6, 106), SLE_CONDNULL(2, 0, 106), SLE_CONDNULL(2, 0, 5), SLE_CONDNULL(4, 6, 106), SLE_CONDNULL(2, 0, 5), SLE_CONDNULL(4, 6, 106), SLE_CONDNULL(2, 0, 106), SLE_CONDNULL(2, 0, 68), SLE_CONDNULL(4, 69, 106), SLE_CONDNULL(18, 0, 106), SLE_CONDNULL(20, 0, 106), SLE_CONDNULL(32, 0, 106), SLE_CONDNULL(64, 2, 106), }
Definition at line 355 of file company_sl.cpp.
const ChunkHandler _company_chunk_handlers[] |
{ { 'PLYR', Save_PLYR, Load_PLYR, Ptrs_PLYR, Check_PLYR, CH_ARRAY | CH_LAST}, }
const SaveLoad _company_economy_desc[] [static] |
{ SLE_CONDVAR(CompanyEconomyEntry, income, SLE_FILE_I32 | SLE_VAR_I64, 0, 1), SLE_CONDVAR(CompanyEconomyEntry, income, SLE_INT64, 2, SL_MAX_VERSION), SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_FILE_I32 | SLE_VAR_I64, 0, 1), SLE_CONDVAR(CompanyEconomyEntry, expenses, SLE_INT64, 2, SL_MAX_VERSION), SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_FILE_I32 | SLE_VAR_I64, 0, 1), SLE_CONDVAR(CompanyEconomyEntry, company_value, SLE_INT64, 2, SL_MAX_VERSION), SLE_VAR(CompanyEconomyEntry, delivered_cargo, SLE_INT32), SLE_VAR(CompanyEconomyEntry, performance_history, SLE_INT32), }
Definition at line 335 of file company_sl.cpp.
const SaveLoad _company_livery_desc[] [static] |
{ SLE_CONDVAR(Livery, in_use, SLE_BOOL, 34, SL_MAX_VERSION), SLE_CONDVAR(Livery, colour1, SLE_UINT8, 34, SL_MAX_VERSION), SLE_CONDVAR(Livery, colour2, SLE_UINT8, 34, SL_MAX_VERSION), }
Definition at line 395 of file company_sl.cpp.
const SaveLoad _company_settings_desc[] [static] |
{ SLE_CONDNULL(512, 16, 18), SLE_CONDREF(Company, engine_renew_list, REF_ENGINE_RENEWS, 19, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.engine_renew, SLE_BOOL, 16, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.engine_renew_months, SLE_INT16, 16, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.engine_renew_money, SLE_UINT32, 16, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.renew_keep_length, SLE_BOOL, 2, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.vehicle.servint_ispercent, SLE_BOOL, 120, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.vehicle.servint_trains, SLE_UINT16, 120, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.vehicle.servint_roadveh, SLE_UINT16, 120, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.vehicle.servint_aircraft, SLE_UINT16, 120, SL_MAX_VERSION), SLE_CONDVAR(Company, settings.vehicle.servint_ships, SLE_UINT16, 120, SL_MAX_VERSION), SLE_CONDNULL(63, 2, 143), }
Definition at line 292 of file company_sl.cpp.
const SaveLoad _company_settings_skip_desc[] [static] |
{ SLE_CONDNULL(512, 16, 18), SLE_CONDNULL(2, 19, 68), SLE_CONDNULL(4, 69, SL_MAX_VERSION), SLE_CONDNULL(1, 16, SL_MAX_VERSION), SLE_CONDNULL(2, 16, SL_MAX_VERSION), SLE_CONDNULL(4, 16, SL_MAX_VERSION), SLE_CONDNULL(1, 2, SL_MAX_VERSION), SLE_CONDNULL(1, 120, SL_MAX_VERSION), SLE_CONDNULL(2, 120, SL_MAX_VERSION), SLE_CONDNULL(2, 120, SL_MAX_VERSION), SLE_CONDNULL(2, 120, SL_MAX_VERSION), SLE_CONDNULL(2, 120, SL_MAX_VERSION), SLE_CONDNULL(63, 2, 143), }
Definition at line 313 of file company_sl.cpp.