Vehicle repair costs patch: implement save/load changes.
This commit is contained in:
@@ -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
|
||||
|
||||
const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = {
|
||||
{ XSLFI_VEHICLE_REPAIR_COST, XSCF_NULL, 1, 1, "vehicle_repair_cost", NULL, NULL, NULL },
|
||||
{ XSLFI_NULL, XSCF_NULL, 0, 0, NULL, NULL, NULL, NULL },// This is the end marker
|
||||
};
|
||||
|
||||
|
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
enum SlXvFeatureIndex {
|
||||
XSLFI_NULL = 0, ///< Unused value, to indicate that no extended feature test is in use
|
||||
XSLFI_VEHICLE_REPAIR_COST, ///< Vehicle repair costs patch
|
||||
|
||||
XSLFI_SIZE, ///< Total count of features, including null feature
|
||||
};
|
||||
|
@@ -92,7 +92,6 @@ enum SLRefType {
|
||||
|
||||
/** Highest possible savegame version. */
|
||||
#define SL_MAX_VERSION UINT16_MAX
|
||||
#define SL_REPAIRCOST 200
|
||||
|
||||
/** Flags of a chunk. */
|
||||
enum ChunkType {
|
||||
|
@@ -369,7 +369,7 @@ void AfterLoadVehicles(bool part_of_load)
|
||||
}
|
||||
}
|
||||
|
||||
if (IsSavegameVersionBefore(SL_REPAIRCOST)) {
|
||||
if (SlXvIsFeatureMissing(XSLFI_VEHICLE_REPAIR_COST)) {
|
||||
/* repair cost is value for new vehicles and each week +/256 part for old */
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (!v->IsPrimaryVehicle()) continue;
|
||||
@@ -706,7 +706,7 @@ const SaveLoad *GetVehicleDescription(VehicleType vt)
|
||||
SLEG_CONDVAR( _cargo_loaded_at_xy, SLE_UINT32, 51, 67),
|
||||
SLE_CONDVAR(Vehicle, value, SLE_FILE_I32 | SLE_VAR_I64, 0, 64),
|
||||
SLE_CONDVAR(Vehicle, value, SLE_INT64, 65, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, repair_cost, SLE_INT64, SL_REPAIRCOST, SL_MAX_VERSION),
|
||||
SLE_CONDVAR_X(Vehicle, repair_cost, SLE_INT64, 0, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_VEHICLE_REPAIR_COST)),
|
||||
|
||||
SLE_CONDVAR(Vehicle, random_bits, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
SLE_CONDVAR(Vehicle, waiting_triggers, SLE_UINT8, 2, SL_MAX_VERSION),
|
||||
|
Reference in New Issue
Block a user