diff options
author | Peter Nelson <peter1138@openttd.org> | 2019-01-26 01:48:40 +0000 |
---|---|---|
committer | PeterN <peter@fuzzle.org> | 2019-02-02 21:39:06 +0000 |
commit | 9de12521ecec338160c37920e65fd02c0c742bef (patch) | |
tree | 66f41585907f29ddbe22bb340c34bd23bffa58bd /src/saveload/economy_sl.cpp | |
parent | ea4ea628163c735db4c4714966c9bc1c560e0f61 (diff) | |
download | openttd-9de12521ecec338160c37920e65fd02c0c742bef.tar.xz |
Codechange: Convert saveload numbers to enum values.
(This was mostly achieved with a few in-place regexes)
Diffstat (limited to 'src/saveload/economy_sl.cpp')
-rw-r--r-- | src/saveload/economy_sl.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/saveload/economy_sl.cpp b/src/saveload/economy_sl.cpp index 997a7ae6e..10ca8ec44 100644 --- a/src/saveload/economy_sl.cpp +++ b/src/saveload/economy_sl.cpp @@ -21,7 +21,7 @@ static void Load_PRIC() { /* Old games store 49 base prices, very old games store them as int32 */ - int vt = IsSavegameVersionBefore(65) ? SLE_FILE_I32 : SLE_FILE_I64; + int vt = IsSavegameVersionBefore(SLV_65) ? SLE_FILE_I32 : SLE_FILE_I64; SlArray(NULL, 49, vt | SLE_VAR_NULL); SlArray(NULL, 49, SLE_FILE_U16 | SLE_VAR_NULL); } @@ -29,25 +29,25 @@ static void Load_PRIC() /** Cargo payment rates in pre 126 savegames */ static void Load_CAPR() { - uint num_cargo = IsSavegameVersionBefore(55) ? 12 : IsSavegameVersionBefore(199) ? 32 : NUM_CARGO; - int vt = IsSavegameVersionBefore(65) ? SLE_FILE_I32 : SLE_FILE_I64; + uint num_cargo = IsSavegameVersionBefore(SLV_55) ? 12 : IsSavegameVersionBefore(SLV_199) ? 32 : NUM_CARGO; + int vt = IsSavegameVersionBefore(SLV_65) ? SLE_FILE_I32 : SLE_FILE_I64; SlArray(NULL, num_cargo, vt | SLE_VAR_NULL); SlArray(NULL, num_cargo, SLE_FILE_U16 | SLE_VAR_NULL); } static const SaveLoad _economy_desc[] = { - SLE_CONDNULL(4, 0, 65), // max_loan - SLE_CONDNULL(8, 65, 144), // max_loan - SLE_CONDVAR(Economy, old_max_loan_unround, SLE_FILE_I32 | SLE_VAR_I64, 0, 65), - SLE_CONDVAR(Economy, old_max_loan_unround, SLE_INT64, 65, 126), - SLE_CONDVAR(Economy, old_max_loan_unround_fract, SLE_UINT16, 70, 126), - SLE_CONDVAR(Economy, inflation_prices, SLE_UINT64, 126, SL_MAX_VERSION), - SLE_CONDVAR(Economy, inflation_payment, SLE_UINT64, 126, SL_MAX_VERSION), + SLE_CONDNULL(4, SL_MIN_VERSION, SLV_65), // max_loan + SLE_CONDNULL(8, SLV_65, SLV_144), // max_loan + SLE_CONDVAR(Economy, old_max_loan_unround, SLE_FILE_I32 | SLE_VAR_I64, SL_MIN_VERSION, SLV_65), + SLE_CONDVAR(Economy, old_max_loan_unround, SLE_INT64, SLV_65, SLV_126), + SLE_CONDVAR(Economy, old_max_loan_unround_fract, SLE_UINT16, SLV_70, SLV_126), + SLE_CONDVAR(Economy, inflation_prices, SLE_UINT64, SLV_126, SL_MAX_VERSION), + SLE_CONDVAR(Economy, inflation_payment, SLE_UINT64, SLV_126, SL_MAX_VERSION), SLE_VAR(Economy, fluct, SLE_INT16), SLE_VAR(Economy, interest_rate, SLE_UINT8), SLE_VAR(Economy, infl_amount, SLE_UINT8), SLE_VAR(Economy, infl_amount_pr, SLE_UINT8), - SLE_CONDVAR(Economy, industry_daily_change_counter, SLE_UINT32, 102, SL_MAX_VERSION), + SLE_CONDVAR(Economy, industry_daily_change_counter, SLE_UINT32, SLV_102, SL_MAX_VERSION), SLE_END() }; @@ -61,14 +61,14 @@ static void Save_ECMY() static void Load_ECMY() { SlObject(&_economy, _economy_desc); - StartupIndustryDailyChanges(IsSavegameVersionBefore(102)); // old savegames will need to be initialized + StartupIndustryDailyChanges(IsSavegameVersionBefore(SLV_102)); // old savegames will need to be initialized } static const SaveLoad _cargopayment_desc[] = { SLE_REF(CargoPayment, front, REF_VEHICLE), SLE_VAR(CargoPayment, route_profit, SLE_INT64), SLE_VAR(CargoPayment, visual_profit, SLE_INT64), - SLE_CONDVAR(CargoPayment, visual_transfer, SLE_INT64, 181, SL_MAX_VERSION), + SLE_CONDVAR(CargoPayment, visual_transfer, SLE_INT64, SLV_181, SL_MAX_VERSION), SLE_END() }; |