Add upstream savegame load support for versions 313 and 314

pull/532/head
Jonathan G Rennison 1 year ago
parent e5654a0414
commit 929dd46fcf

@ -365,6 +365,8 @@ enum SaveLoadVersion : uint16 {
SLV_EXTEND_VEHICLE_RANDOM, ///< 310 PR#10701 Extend vehicle random bits.
SLV_EXTEND_ENTITY_MAPPING, ///< 311 PR#10672 Extend entity mapping range.
SLV_DISASTER_VEH_STATE, ///< 312 PR#10798 Explicit storage of disaster vehicle state.
SLV_SAVEGAME_ID, ///< 313 PR#10719 Add an unique ID to every savegame (used to deduplicate surveys).
SLV_STRING_GAMELOG, ///< 314 PR#10801 Use std::string in gamelog.
SL_MAX_VERSION, ///< Highest possible saveload version

@ -44,11 +44,13 @@ public:
};
static char old_revision_text[GAMELOG_REVISION_LENGTH];
static std::string revision_test;
class SlGamelogRevision : public DefaultSaveLoadHandler<SlGamelogRevision, LoggedChange> {
public:
inline static const SaveLoad description[] = {
SLEG_ARR("revision.text", old_revision_text, SLE_UINT8),
SLEG_CONDARR("revision.text", old_revision_text, SLE_UINT8, GAMELOG_REVISION_LENGTH, SL_MIN_VERSION, SLV_STRING_GAMELOG),
SLEG_CONDSSTR("revision.text", revision_test, SLE_STR, SLV_STRING_GAMELOG, SL_MAX_VERSION),
SLE_VAR(LoggedChange, revision.newgrf, SLE_UINT32),
SLE_VAR(LoggedChange, revision.slver, SLE_UINT16),
SLE_VAR(LoggedChange, revision.modified, SLE_UINT8),
@ -65,7 +67,11 @@ public:
{
if (lc->ct != GLCT_REVISION) return;
SlObject(lc, this->GetLoadDescription());
lc->revision.text = stredup(old_revision_text, lastof(old_revision_text));
if (IsSavegameVersionBefore(SLV_STRING_GAMELOG)) {
lc->revision.text = stredup(old_revision_text, lastof(old_revision_text));
} else {
lc->revision.text = stredup(revision_test.c_str());
}
}
void LoadCheck(LoggedChange *lc) const override { this->Load(lc); }

@ -958,7 +958,7 @@ SaveLoadTable GetVehicleDescription(VehicleType vt)
SLE_VAR(Vehicle, vehstatus, SLE_UINT8),
SLE_CONDVAR_X(Vehicle, current_order.dest, SLE_FILE_U8 | SLE_VAR_U16, SL_MIN_VERSION, SLV_5, SlXvFeatureTest(XSLFTO_AND, XSLFI_DISASTER_VEH_STATE, 0, 0)),
SLE_CONDVAR_X(Vehicle, current_order.dest, SLE_UINT16, SLV_5, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_DISASTER_VEH_STATE, 0, 0)),
SLE_CONDVAR_X(Vehicle, state, SLE_UINT16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_DISASTER_VEH_STATE, 1)),
SLE_CONDVAR_X(DisasterVehicle, state, SLE_UINT16, SL_MIN_VERSION, SL_MAX_VERSION, SlXvFeatureTest(XSLFTO_AND, XSLFI_DISASTER_VEH_STATE, 1)),
SLE_VAR(Vehicle, sprite_seq.seq[0].sprite, SLE_FILE_U16 | SLE_VAR_U32),
SLE_CONDVAR(Vehicle, age, SLE_FILE_U16 | SLE_VAR_I32, SL_MIN_VERSION, SLV_31),

Loading…
Cancel
Save