# company_sl.cpp File Reference

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

`#include "../stdafx.h"`
`#include "../company_base.h"`
`#include "../company_func.h"`
`#include "../company_manager_face.h"`
`#include "saveload.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.
static void | SaveLoad_PLYR (Company *c)
static void | Save_PLYR ()
static void | Load_PLYR ()
static void | Ptrs_PLYR ()

## Variables

static const SaveLoad | _company_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 []

## Detailed Description

Code handling saving and loading of company data.

Definition in file company_sl.cpp.

## Function Documentation

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

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

  | face | the face in the old format

Returns:
  the face in the new format

Definition at line 37 of file company_sl.cpp.

References ClampU(), ETHNICITY_BLACK, GB(), GE_WF, GE_WM, GENDER_FEMALE, HasBit(), max(), ScaleCompanyManagerFaceValue(), SetBit(), and SetCompanyManagerFaceBits().

## Variable Documentation

const SaveLoad _company_ai_build_rec_desc[]`[static]`

Initial value:

     {
      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 213 of file company_sl.cpp.

const SaveLoad _company_ai_desc[]`[static]`

Initial value:

     {
      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 182 of file company_sl.cpp.

const ChunkHandler _company_chunk_handlers[]

Initial value:

     {
      { 'PLYR', Save_PLYR, Load_PLYR, Ptrs_PLYR, CH_ARRAY | CH_LAST},
    }

const SaveLoad _company_economy_desc[]`[static]`

Initial value:

     {

      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 162 of file company_sl.cpp.

const SaveLoad _company_livery_desc[]`[static]`

Initial value:

     {
      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 222 of file company_sl.cpp.