Infrastructure sharing patch: save/load changes.

This commit is contained in:
Jonathan G Rennison 2015-08-06 23:02:47 +01:00
parent 037cce3b38
commit b3ebb1f729
5 changed files with 25 additions and 13 deletions

View File

@ -2390,7 +2390,7 @@ bool AfterLoadGame()
FOR_ALL_DEPOTS(d) d->build_date = _date; FOR_ALL_DEPOTS(d) d->build_date = _date;
} }
if (IsSavegameVersionBefore(200)) { if (SlXvIsFeatureMissing(XSLFI_INFRA_SHARING)) {
Company *c; Company *c;
FOR_ALL_COMPANIES(c) { FOR_ALL_COMPANIES(c) {
/* yearly_expenses has 3*15 entries now, saveload code gave us 3*13. /* yearly_expenses has 3*15 entries now, saveload code gave us 3*13.

View File

@ -283,8 +283,8 @@ static const SaveLoad _company_desc[] = {
/* yearly expenses was changed to 64-bit in savegame version 2. */ /* yearly expenses was changed to 64-bit in savegame version 2. */
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_FILE_I32 | SLE_VAR_I64, 3 * 13, 0, 1), SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_FILE_I32 | SLE_VAR_I64, 3 * 13, 0, 1),
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, 2, 199), SLE_CONDARR_X(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 13, 2, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING, 0, 0)),
SLE_CONDARR(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 15, 200, SL_MAX_VERSION), SLE_CONDARR_X(CompanyProperties, yearly_expenses, SLE_INT64, 3 * 15, 2, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)),
SLE_CONDVAR(CompanyProperties, is_ai, SLE_BOOL, 2, SL_MAX_VERSION), SLE_CONDVAR(CompanyProperties, is_ai, SLE_BOOL, 2, SL_MAX_VERSION),
SLE_CONDNULL(1, 107, 111), ///< is_noai SLE_CONDNULL(1, 107, 111), ///< is_noai

View File

@ -45,6 +45,7 @@ std::vector<uint32> _sl_xv_discardable_chunk_ids; ///< list of chunks
static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk static const uint32 _sl_xv_slxi_chunk_version = 0; ///< current version os SLXI chunk
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
{ XSLFI_INFRA_SHARING, XSCF_NULL, 1, 1, "infra_sharing", NULL, NULL, NULL },
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker { XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
}; };

View File

@ -21,6 +21,7 @@
*/ */
enum SlXvFeatureIndex { enum SlXvFeatureIndex {
XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use
XSLFI_INFRA_SHARING, ///< Infrastructure sharing patch
XSLFI_SIZE, ///< Total count of features, including null feature XSLFI_SIZE, ///< Total count of features, including null feature
}; };

View File

@ -1464,88 +1464,98 @@ from = 77
def = true def = true
cat = SC_EXPERT cat = SC_EXPERT
[SDT_BOOL] [SDT_BOOL]
base = GameSettings base = GameSettings
var = economy.infrastructure_sharing[0] var = economy.infrastructure_sharing[0]
from = 200
def = false def = false
str = STR_CONFIG_SETTING_SHARING_RAIL str = STR_CONFIG_SETTING_SHARING_RAIL
proc = CheckSharingRail proc = CheckSharingRail
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.infrastructure_sharing.rail""
[SDT_BOOL] [SDT_BOOL]
base = GameSettings base = GameSettings
var = economy.infrastructure_sharing[1] var = economy.infrastructure_sharing[1]
from = 200
def = false def = false
str = STR_CONFIG_SETTING_SHARING_ROAD str = STR_CONFIG_SETTING_SHARING_ROAD
proc = CheckSharingRoad proc = CheckSharingRoad
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.infrastructure_sharing.road""
[SDT_BOOL] [SDT_BOOL]
base = GameSettings base = GameSettings
var = economy.infrastructure_sharing[2] var = economy.infrastructure_sharing[2]
from = 200
def = false def = false
str = STR_CONFIG_SETTING_SHARING_WATER str = STR_CONFIG_SETTING_SHARING_WATER
proc = CheckSharingWater proc = CheckSharingWater
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.infrastructure_sharing.water""
[SDT_BOOL] [SDT_BOOL]
base = GameSettings base = GameSettings
var = economy.infrastructure_sharing[3] var = economy.infrastructure_sharing[3]
from = 200
def = false def = false
str = STR_CONFIG_SETTING_SHARING_AIR str = STR_CONFIG_SETTING_SHARING_AIR
proc = CheckSharingAir proc = CheckSharingAir
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.infrastructure_sharing.air""
[SDT_VAR] [SDT_VAR]
base = GameSettings base = GameSettings
var = economy.sharing_fee[0] var = economy.sharing_fee[0]
type = SLE_UINT type = SLE_UINT
from = 200
def = 100 def = 100
min = 0 min = 0
max = 1000000 max = 1000000
interval = 10 interval = 10
str = STR_CONFIG_SETTING_SHARING_FEE_RAIL str = STR_CONFIG_SETTING_SHARING_FEE_RAIL
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.sharing_fee.rail""
[SDT_VAR] [SDT_VAR]
base = GameSettings base = GameSettings
var = economy.sharing_fee[1] var = economy.sharing_fee[1]
type = SLE_UINT type = SLE_UINT
from = 200
def = 100 def = 100
min = 0 min = 0
max = 1000000 max = 1000000
interval = 10 interval = 10
str = STR_CONFIG_SETTING_SHARING_FEE_ROAD str = STR_CONFIG_SETTING_SHARING_FEE_ROAD
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.sharing_fee.road""
[SDT_VAR] [SDT_VAR]
base = GameSettings base = GameSettings
var = economy.sharing_fee[2] var = economy.sharing_fee[2]
type = SLE_UINT type = SLE_UINT
from = 200
def = 100 def = 100
min = 0 min = 0
max = 1000000 max = 1000000
interval = 10 interval = 10
str = STR_CONFIG_SETTING_SHARING_FEE_ROAD str = STR_CONFIG_SETTING_SHARING_FEE_WATER
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.sharing_fee.water""
[SDT_VAR] [SDT_VAR]
base = GameSettings base = GameSettings
var = economy.sharing_fee[3] var = economy.sharing_fee[3]
type = SLE_UINT type = SLE_UINT
from = 200
def = 100 def = 100
min = 0 min = 0
max = 1000000 max = 1000000
interval = 10 interval = 10
str = STR_CONFIG_SETTING_SHARING_FEE_AIR str = STR_CONFIG_SETTING_SHARING_FEE_AIR
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.sharing_fee.air""
[SDT_BOOL] [SDT_BOOL]
base = GameSettings base = GameSettings
var = economy.sharing_payment_in_debt var = economy.sharing_payment_in_debt
from = 200
def = false def = false
str = STR_CONFIG_SETTING_SHARING_PAYMENT_IN_DEBT str = STR_CONFIG_SETTING_SHARING_PAYMENT_IN_DEBT
extver = SlXvFeatureTest(XSLFTO_AND, XSLFI_INFRA_SHARING)
patxname = ""infra_sharing.economy.sharing_payment_in_debt""
; previously ai-new setting. ; previously ai-new setting.
[SDT_NULL] [SDT_NULL]