OpenTTD Source 20250719-master-gb8e56cd05d
company_sl.cpp File Reference

Code handling saving and loading of company data. More...

#include "../stdafx.h"
#include "saveload.h"
#include "compat/company_sl_compat.h"
#include "../company_func.h"
#include "../company_manager_face.h"
#include "../fios.h"
#include "../tunnelbridge_map.h"
#include "../tunnelbridge.h"
#include "../station_base.h"
#include "../strings_func.h"
#include "table/strings.h"
#include "../safeguards.h"

Go to the source code of this file.

Data Structures

struct  CompanyOldAI
 
class  SlCompanyOldAIBuildRec
 
class  SlCompanyOldAI
 
class  SlCompanySettings
 
class  SlCompanyEconomy
 
class  SlCompanyOldEconomy
 
class  SlCompanyLiveries
 
class  SlAllowListData
 
struct  SlAllowListData::KeyWrapper
 
struct  PLYRChunkHandler
 

Functions

static const FaceVarFindFaceVar (FaceVars style, FaceVarType type, StringID name)
 Search for a face variable by type and name.
 
CompanyManagerFace ConvertFromOldCompanyManagerFace (uint32_t 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.
 
const ChunkHandlerTable _company_chunk_handlers (company_chunk_handlers)
 

Variables

static const SaveLoad _company_desc []
 
static const PLYRChunkHandler PLYR
 
static const ChunkHandlerRef company_chunk_handlers []
 

Detailed Description

Code handling saving and loading of company data.

Definition in file company_sl.cpp.

Function Documentation

◆ AfterLoadCompanyStats()

void AfterLoadCompanyStats ( )

Rebuilding of company statistics after loading a savegame.

Definition at line 126 of file company_sl.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tpool_type, Tcache >::PoolItem<&_company_pool >::Iterate().

Referenced by AfterLoadGame(), CheckCaches(), and ReloadNewGRFData().

◆ ConvertFromOldCompanyManagerFace()

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):

  • 4 and 5: chin
  • 6 to 9: eyebrows
  • 10 to 13: nose
  • 13 to 15: lips (also moustache for males)
  • 16 to 19: hair
  • 20 to 22: eye colour
  • 20 to 27: tie, ear rings etc.
  • 28 to 30: glasses
  • 19, 26 and 27: race (bit 27 set and bit 19 equal to bit 26 = black, otherwise white)
  • 31: gender (0 = male, 1 = female)
Parameters
facethe face in the old format
Returns
the face in the new format

Definition at line 59 of file company_sl.cpp.

References ClampU(), FindFaceVar(), GB(), GetCompanyManagerFaceSpec(), HasBit(), and CompanyManagerFace::style.

Referenced by AfterLoadGame().

◆ FindFaceVar()

static const FaceVar * FindFaceVar ( FaceVars  style,
FaceVarType  type,
StringID  name 
)
static

Search for a face variable by type and name.

Parameters
styleFace style to find variable in.
typeType of variable to look up.
nameName (string) of variable to look up.
Returns
Face variable if present, otherwise nullptr.

Definition at line 34 of file company_sl.cpp.

Referenced by ConvertFromOldCompanyManagerFace().

Variable Documentation

◆ _company_desc

const SaveLoad _company_desc[]
static

Definition at line 491 of file company_sl.cpp.

◆ company_chunk_handlers

const ChunkHandlerRef company_chunk_handlers[]
static
Initial value:
= {
PLYR,
}

Definition at line 619 of file company_sl.cpp.

◆ PLYR

const PLYRChunkHandler PLYR
static

Definition at line 618 of file company_sl.cpp.