mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Automatically drop workaround when the format is next updated
This commit is contained in:
parent
826553f2be
commit
c1f59b1221
7 changed files with 25 additions and 19 deletions
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <climits> // INT_MIN
|
||||
|
||||
#include <osgDB/WriteFile>
|
||||
|
||||
|
@ -371,7 +370,7 @@ namespace ESSImport
|
|||
if (cellref.mHasACDT)
|
||||
convertACDT(cellref.mACDT, objstate.mCreatureStats);
|
||||
else
|
||||
objstate.mCreatureStats.mGoldPool = INT_MIN; // HACK: indicates no ACDT
|
||||
objstate.mCreatureStats.mMissingACDT = true;
|
||||
if (cellref.mHasACSC)
|
||||
convertACSC(cellref.mACSC, objstate.mCreatureStats);
|
||||
convertNpcData(cellref, objstate.mNpcStats);
|
||||
|
@ -414,7 +413,7 @@ namespace ESSImport
|
|||
if (cellref.mHasACDT)
|
||||
convertACDT(cellref.mACDT, objstate.mCreatureStats);
|
||||
else
|
||||
objstate.mCreatureStats.mGoldPool = INT_MIN; // HACK: indicates no ACDT
|
||||
objstate.mCreatureStats.mMissingACDT = true;
|
||||
if (cellref.mHasACSC)
|
||||
convertACSC(cellref.mACSC, objstate.mCreatureStats);
|
||||
convertCREC(crecIt->second, objstate);
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "creature.hpp"
|
||||
|
||||
#include <climits> // INT_MIN
|
||||
|
||||
#include <components/misc/rng.hpp>
|
||||
#include <components/debug/debuglog.hpp>
|
||||
#include <components/esm/loadcrea.hpp>
|
||||
|
@ -758,9 +756,7 @@ namespace MWClass
|
|||
{
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
{
|
||||
// FIXME: the use of mGoldPool can be replaced with another flag the next time
|
||||
// the save file format is changed
|
||||
if (creatureState.mCreatureStats.mGoldPool == INT_MIN)
|
||||
if (creatureState.mCreatureStats.mMissingACDT)
|
||||
ensureCustomData(ptr);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "npc.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <climits> // INT_MIN
|
||||
|
||||
#include <components/misc/constants.hpp>
|
||||
#include <components/misc/rng.hpp>
|
||||
|
@ -1302,9 +1301,7 @@ namespace MWClass
|
|||
{
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
{
|
||||
// FIXME: the use of mGoldPool can be replaced with another flag the next time
|
||||
// the save file format is changed
|
||||
if (npcState.mCreatureStats.mGoldPool == INT_MIN)
|
||||
if (npcState.mCreatureStats.mMissingACDT)
|
||||
ensureCustomData(ptr);
|
||||
else
|
||||
// Create a CustomData, but don't fill it from ESM records (not needed)
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "creaturestats.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <climits>
|
||||
|
||||
#include <components/esm/creaturestats.hpp>
|
||||
#include <components/esm/esmreader.hpp>
|
||||
|
@ -558,12 +557,13 @@ namespace MWMechanics
|
|||
state.mHasAiSettings = true;
|
||||
for (int i=0; i<4; ++i)
|
||||
mAiSettings[i].writeState (state.mAiSettings[i]);
|
||||
|
||||
state.mMissingACDT = false;
|
||||
}
|
||||
|
||||
void CreatureStats::readState (const ESM::CreatureStats& state)
|
||||
{
|
||||
// HACK: using mGoldPool as an indicator for lack of ACDT during .ess import
|
||||
if (state.mGoldPool != INT_MIN)
|
||||
if (!state.mMissingACDT)
|
||||
{
|
||||
for (int i=0; i<ESM::Attribute::Length; ++i)
|
||||
mAttributes[i].readState (state.mAttributes[i]);
|
||||
|
|
|
@ -69,8 +69,6 @@ namespace MWMechanics
|
|||
MWWorld::TimeStamp mLastRestock;
|
||||
|
||||
// The pool of merchant gold (not in inventory)
|
||||
// HACK: value of INT_MIN has a special meaning: indicates a converted .ess file
|
||||
// (this is a workaround to avoid changing the save file format)
|
||||
int mGoldPool;
|
||||
|
||||
int mActorId;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
#include "creaturestats.hpp"
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "savedgame.hpp"
|
||||
|
||||
#include <limits>
|
||||
|
||||
void ESM::CreatureStats::load (ESMReader &esm)
|
||||
{
|
||||
|
@ -163,6 +166,13 @@ void ESM::CreatureStats::load (ESMReader &esm)
|
|||
|
||||
mCorprusSpells[id] = stats;
|
||||
}
|
||||
if(esm.getFormat() <= 18)
|
||||
mMissingACDT = mGoldPool == std::numeric_limits<int>::min();
|
||||
else
|
||||
{
|
||||
mMissingACDT = false;
|
||||
esm.getHNOT(mMissingACDT, "NOAC");
|
||||
}
|
||||
}
|
||||
|
||||
void ESM::CreatureStats::save (ESMWriter &esm) const
|
||||
|
@ -173,8 +183,10 @@ void ESM::CreatureStats::save (ESMWriter &esm) const
|
|||
for (int i=0; i<3; ++i)
|
||||
mDynamic[i].save (esm);
|
||||
|
||||
if (mGoldPool)
|
||||
esm.writeHNT ("GOLD", mGoldPool);
|
||||
if (ESM::SavedGame::sCurrentFormat <= 18 && mMissingACDT)
|
||||
esm.writeHNT("GOLD", std::numeric_limits<int>::min());
|
||||
else if(mGoldPool)
|
||||
esm.writeHNT("GOLD", mGoldPool);
|
||||
|
||||
if (mTradeTime.mDay != 0 || mTradeTime.mHour != 0)
|
||||
esm.writeHNT ("TIME", mTradeTime);
|
||||
|
@ -246,6 +258,8 @@ void ESM::CreatureStats::save (ESMWriter &esm) const
|
|||
for (int i=0; i<4; ++i)
|
||||
mAiSettings[i].save(esm);
|
||||
}
|
||||
if(ESM::SavedGame::sCurrentFormat > 18 && mMissingACDT)
|
||||
esm.writeHNT("NOAC", mMissingACDT);
|
||||
}
|
||||
|
||||
void ESM::CreatureStats::blank()
|
||||
|
@ -274,4 +288,5 @@ void ESM::CreatureStats::blank()
|
|||
mDeathAnimation = -1;
|
||||
mLevel = 1;
|
||||
mCorprusSpells.clear();
|
||||
mMissingACDT = false;
|
||||
}
|
||||
|
|
|
@ -85,6 +85,7 @@ namespace ESM
|
|||
signed char mDeathAnimation;
|
||||
ESM::TimeStamp mTimeOfDeath;
|
||||
int mLevel;
|
||||
bool mMissingACDT;
|
||||
|
||||
std::map<std::string, CorprusStats> mCorprusSpells;
|
||||
SpellState mSpells;
|
||||
|
|
Loading…
Reference in a new issue