Drop support for save game format 0 (pre 0.37)

macos_ci_fix
Evil Eye 1 year ago
parent 23aacbd914
commit 194bcb0187

@ -779,32 +779,26 @@ namespace MWClass
const ESM::CreatureState& creatureState = state.asCreatureState();
if (state.mVersion > 0)
if (!ptr.getRefData().getCustomData())
{
if (!ptr.getRefData().getCustomData())
if (creatureState.mCreatureStats.mMissingACDT)
ensureCustomData(ptr);
else
{
if (creatureState.mCreatureStats.mMissingACDT)
ensureCustomData(ptr);
else
{
// Create a CustomData, but don't fill it from ESM records (not needed)
auto data = std::make_unique<CreatureCustomData>();
// Create a CustomData, but don't fill it from ESM records (not needed)
auto data = std::make_unique<CreatureCustomData>();
if (hasInventoryStore(ptr))
data->mContainerStore = std::make_unique<MWWorld::InventoryStore>();
else
data->mContainerStore = std::make_unique<MWWorld::ContainerStore>();
if (hasInventoryStore(ptr))
data->mContainerStore = std::make_unique<MWWorld::InventoryStore>();
else
data->mContainerStore = std::make_unique<MWWorld::ContainerStore>();
MWBase::Environment::get().getWorldModel()->registerPtr(ptr);
data->mContainerStore->setPtr(ptr);
MWBase::Environment::get().getWorldModel()->registerPtr(ptr);
data->mContainerStore->setPtr(ptr);
ptr.getRefData().setCustomData(std::move(data));
}
ptr.getRefData().setCustomData(std::move(data));
}
}
else
ensureCustomData(
ptr); // in openmw 0.30 savegames not all state was saved yet, so need to load it regardless.
CreatureCustomData& customData = ptr.getRefData().getCustomData()->asCreatureCustomData();

@ -1333,25 +1333,19 @@ namespace MWClass
const ESM::NpcState& npcState = state.asNpcState();
if (state.mVersion > 0)
if (!ptr.getRefData().getCustomData())
{
if (!ptr.getRefData().getCustomData())
if (npcState.mCreatureStats.mMissingACDT)
ensureCustomData(ptr);
else
{
if (npcState.mCreatureStats.mMissingACDT)
ensureCustomData(ptr);
else
{
// Create a CustomData, but don't fill it from ESM records (not needed)
auto data = std::make_unique<NpcCustomData>();
MWBase::Environment::get().getWorldModel()->registerPtr(ptr);
data->mInventoryStore.setPtr(ptr);
ptr.getRefData().setCustomData(std::move(data));
}
// Create a CustomData, but don't fill it from ESM records (not needed)
auto data = std::make_unique<NpcCustomData>();
MWBase::Environment::get().getWorldModel()->registerPtr(ptr);
data->mInventoryStore.setPtr(ptr);
ptr.getRefData().setCustomData(std::move(data));
}
}
else
ensureCustomData(
ptr); // in openmw 0.30 savegames not all state was saved yet, so need to load it regardless.
NpcCustomData& customData = ptr.getRefData().getCustomData()->asNpcCustomData();

@ -250,7 +250,7 @@ namespace MWDialogue
void Journal::readRecord(ESM::ESMReader& reader, uint32_t type)
{
if (type == ESM::REC_JOUR || type == ESM::REC_JOUR_LEGACY)
if (type == ESM::REC_JOUR)
{
ESM::JournalEntry record;
record.load(reader);

@ -472,7 +472,6 @@ void MWState::StateManager::loadGame(const Character* character, const std::file
break;
case ESM::REC_JOUR:
case ESM::REC_JOUR_LEGACY:
case ESM::REC_QUES:
MWBase::Environment::get().getJournal()->readRecord(reader, n.toInt());

@ -252,16 +252,16 @@ namespace
if (!record)
return;
if (state.mVersion < 15)
if (state.mVersion <= ESM::MaxOldRestockingFormatVersion)
fixRestocking(record, state);
if (state.mVersion < 17)
if (state.mVersion <= ESM::MaxClearModifiersFormatVersion)
{
if constexpr (std::is_same_v<T, ESM::Creature>)
MWWorld::convertMagicEffects(state.mCreatureStats, state.mInventory);
else if constexpr (std::is_same_v<T, ESM::NPC>)
MWWorld::convertMagicEffects(state.mCreatureStats, state.mInventory, &state.mNpcStats);
}
else if (state.mVersion < 20)
else if (state.mVersion <= ESM::MaxOldCreatureStatsFormatVersion)
{
if constexpr (std::is_same_v<T, ESM::Creature> || std::is_same_v<T, ESM::NPC>)
MWWorld::convertStats(state.mCreatureStats);

@ -334,12 +334,7 @@ namespace MWWorld
if (player.mObject.mNpcStats.mIsWerewolf)
{
if (player.mObject.mNpcStats.mWerewolfDeprecatedData)
{
saveStats();
setWerewolfStats();
}
else if (reader.getFormatVersion() <= ESM::MaxOldSkillsAndAttributesFormatVersion)
if (reader.getFormatVersion() <= ESM::MaxOldSkillsAndAttributesFormatVersion)
{
setWerewolfStats();
if (player.mSetWerewolfAcrobatics)

@ -272,8 +272,8 @@ namespace
ESM::CurrentContentFormatVersion,
ESM::MaxOldWeatherFormatVersion,
ESM::MaxOldDeathAnimationFormatVersion,
ESM::MaxOldForOfWarFormatVersion,
ESM::MaxWerewolfDeprecatedDataFormatVersion,
ESM::MaxOldFogOfWarFormatVersion,
ESM::MaxUnoptimizedCharacterDataFormatVersion,
ESM::MaxOldTimeLeftFormatVersion,
ESM::MaxIntFallbackFormatVersion,
ESM::MaxClearModifiersFormatVersion,

@ -146,8 +146,6 @@ namespace ESM
// format 0 - saved games
REC_SAVE = esm3Recname("SAVE"),
REC_JOUR_LEGACY = esm3Recname("\xa4UOR"), // "\xa4UOR", rather than "JOUR", little oversight when magic numbers
// were calculated by hand, needs to be supported for older files now
REC_JOUR = esm3Recname("JOUR"),
REC_QUES = esm3Recname("QUES"),
REC_GSCR = esm3Recname("GSCR"),

@ -38,7 +38,7 @@ namespace ESM
mHitRecovery = false;
mBlock = false;
mRecalcDynamicStats = false;
if (esm.getFormatVersion() <= MaxWerewolfDeprecatedDataFormatVersion)
if (esm.getFormatVersion() <= MaxUnoptimizedCharacterDataFormatVersion)
{
esm.getHNOT(mDead, "DEAD");
esm.getHNOT(mDeathAnimationFinished, "DFNT");
@ -46,13 +46,9 @@ namespace ESM
mDeathAnimationFinished = true;
esm.getHNOT(mDied, "DIED");
esm.getHNOT(mMurdered, "MURD");
if (esm.isNextSub("FRHT"))
esm.skipHSub(); // Friendly hits, no longer used
esm.getHNOT(mTalkedTo, "TALK");
esm.getHNOT(mAlarmed, "ALRM");
esm.getHNOT(mAttacked, "ATKD");
if (esm.isNextSub("HOST"))
esm.skipHSub(); // Hostile, no longer used
if (esm.isNextSub("ATCK"))
esm.skipHSub(); // attackingOrSpell, no longer used
esm.getHNOT(mKnockdown, "KNCK");
@ -82,9 +78,6 @@ namespace ESM
mMovementFlags = 0;
esm.getHNOT(mMovementFlags, "MOVE");
if (esm.isNextSub("ASTR"))
esm.skipHSub(); // attackStrength, no longer used
mFallHeight = 0;
esm.getHNOT(mFallHeight, "FALL");
@ -92,7 +85,7 @@ namespace ESM
mLastHitAttemptObject = esm.getHNORefId("LHAT");
if (esm.getFormatVersion() <= MaxWerewolfDeprecatedDataFormatVersion)
if (esm.getFormatVersion() <= MaxUnoptimizedCharacterDataFormatVersion)
esm.getHNOT(mRecalcDynamicStats, "CALC");
mDrawState = 0;

@ -22,14 +22,6 @@ namespace ESM
esm.getHNT(reaction, "INTV");
mChangedFactionReaction[faction][faction2] = reaction;
}
// no longer used
while (esm.isNextSub("REAC"))
{
esm.skipHSub();
esm.getSubName();
esm.skipHSub();
}
}
}

@ -74,7 +74,7 @@ namespace ESM
tex.mImageData.resize(imageSize);
esm.getExact(tex.mImageData.data(), imageSize);
if (dataFormat <= MaxOldForOfWarFormatVersion)
if (dataFormat <= MaxOldFogOfWarFormatVersion)
convertFogOfWar(tex.mImageData);
mFogTextures.push_back(tex);

@ -11,10 +11,11 @@ namespace ESM
inline constexpr FormatVersion CurrentContentFormatVersion = 1;
inline constexpr FormatVersion MaxOldWeatherFormatVersion = 1;
inline constexpr FormatVersion MaxOldDeathAnimationFormatVersion = 2;
inline constexpr FormatVersion MaxOldForOfWarFormatVersion = 6;
inline constexpr FormatVersion MaxWerewolfDeprecatedDataFormatVersion = 7;
inline constexpr FormatVersion MaxOldFogOfWarFormatVersion = 6;
inline constexpr FormatVersion MaxUnoptimizedCharacterDataFormatVersion = 7;
inline constexpr FormatVersion MaxOldTimeLeftFormatVersion = 8;
inline constexpr FormatVersion MaxIntFallbackFormatVersion = 10;
inline constexpr FormatVersion MaxOldRestockingFormatVersion = 14;
inline constexpr FormatVersion MaxClearModifiersFormatVersion = 16;
inline constexpr FormatVersion MaxOldAiPackageFormatVersion = 17;
inline constexpr FormatVersion MaxOldSkillsAndAttributesFormatVersion = 18;
@ -27,7 +28,7 @@ namespace ESM
inline constexpr FormatVersion MaxActiveSpellSlotIndexFormatVersion = 27;
inline constexpr FormatVersion CurrentSaveGameFormatVersion = 29;
inline constexpr FormatVersion MinSupportedSaveGameFormatVersion = 0;
inline constexpr FormatVersion MinSupportedSaveGameFormatVersion = 1;
inline constexpr FormatVersion OpenMW0_48SaveGameFormatVersion = 21;
inline constexpr FormatVersion OpenMW0_49SaveGameFormatVersion = CurrentSaveGameFormatVersion;
}

@ -22,14 +22,6 @@ namespace ESM
ObjectState state;
// obsolete
if (esm.isNextSub("SLOT"))
{
int32_t slot;
esm.getHT(slot);
mEquipmentSlots[index] = slot;
}
state.mRef.loadId(esm, true);
state.load(esm);

@ -41,46 +41,6 @@ namespace ESM
for (auto& skill : mSkills)
skill.load(esm, intFallback);
mWerewolfDeprecatedData = false;
if (esm.getFormatVersion() <= MaxWerewolfDeprecatedDataFormatVersion && esm.peekNextSub("STBA"))
{
// we have deprecated werewolf skills, stored interleaved
// Load into one big vector, then remove every 2nd value
mWerewolfDeprecatedData = true;
std::vector<StatState<float>> skills(mSkills.begin(), mSkills.end());
for (size_t i = 0; i < std::size(mSkills); ++i)
{
StatState<float> skill;
skill.load(esm, intFallback);
skills.push_back(skill);
}
int i = 0;
for (std::vector<StatState<float>>::iterator it = skills.begin(); it != skills.end(); ++i)
{
if (i % 2 == 1)
it = skills.erase(it);
else
++it;
}
if (skills.size() != std::size(mSkills))
throw std::runtime_error(
"Invalid number of skill for werewolf deprecated data: " + std::to_string(skills.size()));
std::copy(skills.begin(), skills.end(), mSkills.begin());
}
// No longer used
bool hasWerewolfAttributes = false;
esm.getHNOT(hasWerewolfAttributes, "HWAT");
if (hasWerewolfAttributes)
{
StatState<int32_t> dummy;
for (int i = 0; i < ESM::Attribute::Length; ++i)
dummy.load(esm, intFallback);
mWerewolfDeprecatedData = true;
}
mIsWerewolf = false;
esm.getHNOT(mIsWerewolf, "WOLF");
@ -93,14 +53,6 @@ namespace ESM
mWerewolfKills = 0;
esm.getHNOT(mWerewolfKills, "WKIL");
// No longer used
if (esm.isNextSub("PROF"))
esm.skipHSub(); // int profit
// No longer used
if (esm.isNextSub("ASTR"))
esm.skipHSub(); // attackStrength
mLevelProgress = 0;
esm.getHNOT(mLevelProgress, "LPRO");
@ -116,14 +68,6 @@ namespace ESM
mTimeToStartDrowning = 0;
esm.getHNOT(mTimeToStartDrowning, "DRTI");
// No longer used
float lastDrowningHit = 0;
esm.getHNOT(lastDrowningHit, "DRLH");
// No longer used
float levelHealthBonus = 0;
esm.getHNOT(levelHealthBonus, "LVLH");
mCrimeId = -1;
esm.getHNOT(mCrimeId, "CRID");
}
@ -195,7 +139,6 @@ namespace ESM
void NpcStats::blank()
{
mWerewolfDeprecatedData = false;
mIsWerewolf = false;
mDisposition = 0;
mBounty = 0;

@ -31,8 +31,6 @@ namespace ESM
bool mIsWerewolf;
bool mWerewolfDeprecatedData;
std::map<ESM::RefId, Faction> mFactions;
int32_t mDisposition;
std::array<StatState<float>, ESM::Skill::Length> mSkills;

@ -48,10 +48,6 @@ namespace ESM
mFlags = 0;
esm.getHNOT(mFlags, "FLAG");
// obsolete
int32_t unused;
esm.getHNOT(unused, "LTIM");
mAnimationState.load(esm);
// FIXME: assuming "false" as default would make more sense, but also break compatibility with older save files

@ -8,9 +8,6 @@ namespace ESM
void QuickKeys::load(ESMReader& esm)
{
if (esm.isNextSub("KEY_"))
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
while (esm.isNextSub("TYPE"))
{
QuickKey key;
@ -18,9 +15,6 @@ namespace ESM
key.mId = esm.getHNRefId("ID__");
mKeys.push_back(key);
if (esm.isNextSub("KEY_"))
esm.getSubHeader(); // no longer used, because sub-record hierachies do not work properly in esmreader
}
}

@ -32,10 +32,6 @@ namespace ESM
int32_t current = 0;
esm.getHNOT(current, "STCU");
mCurrent = static_cast<T>(current);
int32_t oldDamage = 0;
esm.getHNOT(oldDamage, "STDA");
mDamage = static_cast<float>(oldDamage);
}
else
{

Loading…
Cancel
Save