Use overrides, when needed

pull/578/head
Andrei Kortunov 5 years ago
parent aacb569acb
commit 0d66369efb

@ -74,7 +74,7 @@ namespace EsmTool
: mIsDeleted(false) : mIsDeleted(false)
{} {}
std::string getId() const { std::string getId() const override {
return mData.mId; return mData.mId;
} }
@ -82,15 +82,15 @@ namespace EsmTool
return mData; return mData;
} }
void save(ESM::ESMWriter &esm) { void save(ESM::ESMWriter &esm) override {
mData.save(esm, mIsDeleted); mData.save(esm, mIsDeleted);
} }
void load(ESM::ESMReader &esm) { void load(ESM::ESMReader &esm) override {
mData.load(esm, mIsDeleted); mData.load(esm, mIsDeleted);
} }
void print(); void print() override;
}; };
template<> std::string Record<ESM::Cell>::getId() const; template<> std::string Record<ESM::Cell>::getId() const;

@ -79,9 +79,9 @@ template <typename T>
class DefaultConverter : public Converter class DefaultConverter : public Converter
{ {
public: public:
virtual int getStage() { return 0; } int getStage() override { return 0; }
virtual void read(ESM::ESMReader& esm) void read(ESM::ESMReader& esm) override
{ {
T record; T record;
bool isDeleted = false; bool isDeleted = false;
@ -90,7 +90,7 @@ public:
mRecords[record.mId] = record; mRecords[record.mId] = record;
} }
virtual void write(ESM::ESMWriter& esm) void write(ESM::ESMWriter& esm) override
{ {
for (typename std::map<std::string, T>::const_iterator it = mRecords.begin(); it != mRecords.end(); ++it) for (typename std::map<std::string, T>::const_iterator it = mRecords.begin(); it != mRecords.end(); ++it)
{ {
@ -107,7 +107,7 @@ protected:
class ConvertNPC : public Converter class ConvertNPC : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
ESM::NPC npc; ESM::NPC npc;
bool isDeleted = false; bool isDeleted = false;
@ -144,7 +144,7 @@ public:
class ConvertCREA : public Converter class ConvertCREA : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
// See comment in ConvertNPC // See comment in ConvertNPC
ESM::Creature creature; ESM::Creature creature;
@ -162,7 +162,7 @@ public:
class ConvertGlobal : public DefaultConverter<ESM::Global> class ConvertGlobal : public DefaultConverter<ESM::Global>
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
ESM::Global global; ESM::Global global;
bool isDeleted = false; bool isDeleted = false;
@ -183,7 +183,7 @@ public:
class ConvertClass : public DefaultConverter<ESM::Class> class ConvertClass : public DefaultConverter<ESM::Class>
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
ESM::Class class_; ESM::Class class_;
bool isDeleted = false; bool isDeleted = false;
@ -199,7 +199,7 @@ public:
class ConvertBook : public DefaultConverter<ESM::Book> class ConvertBook : public DefaultConverter<ESM::Book>
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
ESM::Book book; ESM::Book book;
bool isDeleted = false; bool isDeleted = false;
@ -215,7 +215,7 @@ public:
class ConvertNPCC : public Converter class ConvertNPCC : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
std::string id = esm.getHNString("NAME"); std::string id = esm.getHNString("NAME");
NPCC npcc; NPCC npcc;
@ -235,7 +235,7 @@ public:
class ConvertREFR : public Converter class ConvertREFR : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
REFR refr; REFR refr;
refr.load(esm); refr.load(esm);
@ -261,7 +261,7 @@ public:
} }
} }
} }
virtual void write(ESM::ESMWriter& esm) void write(ESM::ESMWriter& esm) override
{ {
esm.startRecord(ESM::REC_ASPL); esm.startRecord(ESM::REC_ASPL);
esm.writeHNString("ID__", mSelectedSpell); esm.writeHNString("ID__", mSelectedSpell);
@ -280,14 +280,14 @@ public:
mLevitationEnabled(true) mLevitationEnabled(true)
{} {}
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
PCDT pcdt; PCDT pcdt;
pcdt.load(esm); pcdt.load(esm);
convertPCDT(pcdt, mContext->mPlayer, mContext->mDialogueState.mKnownTopics, mFirstPersonCam, mTeleportingEnabled, mLevitationEnabled, mContext->mControlsState); convertPCDT(pcdt, mContext->mPlayer, mContext->mDialogueState.mKnownTopics, mFirstPersonCam, mTeleportingEnabled, mLevitationEnabled, mContext->mControlsState);
} }
virtual void write(ESM::ESMWriter &esm) void write(ESM::ESMWriter &esm) override
{ {
esm.startRecord(ESM::REC_ENAB); esm.startRecord(ESM::REC_ENAB);
esm.writeHNT("TELE", mTeleportingEnabled); esm.writeHNT("TELE", mTeleportingEnabled);
@ -306,7 +306,7 @@ private:
class ConvertCNTC : public Converter class ConvertCNTC : public Converter
{ {
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
std::string id = esm.getHNString("NAME"); std::string id = esm.getHNString("NAME");
CNTC cntc; CNTC cntc;
@ -318,7 +318,7 @@ class ConvertCNTC : public Converter
class ConvertCREC : public Converter class ConvertCREC : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
std::string id = esm.getHNString("NAME"); std::string id = esm.getHNString("NAME");
CREC crec; CREC crec;
@ -330,8 +330,8 @@ public:
class ConvertFMAP : public Converter class ConvertFMAP : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm); void read(ESM::ESMReader &esm) override;
virtual void write(ESM::ESMWriter &esm); void write(ESM::ESMWriter &esm) override;
private: private:
osg::ref_ptr<osg::Image> mGlobalMapImage; osg::ref_ptr<osg::Image> mGlobalMapImage;
@ -340,8 +340,8 @@ private:
class ConvertCell : public Converter class ConvertCell : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm); void read(ESM::ESMReader& esm) override;
virtual void write(ESM::ESMWriter& esm); void write(ESM::ESMWriter& esm) override;
private: private:
struct Cell struct Cell
@ -362,7 +362,7 @@ private:
class ConvertKLST : public Converter class ConvertKLST : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm) void read(ESM::ESMReader& esm) override
{ {
KLST klst; KLST klst;
klst.load(esm); klst.load(esm);
@ -371,7 +371,7 @@ public:
mContext->mPlayer.mObject.mNpcStats.mWerewolfKills = klst.mWerewolfKills; mContext->mPlayer.mObject.mNpcStats.mWerewolfKills = klst.mWerewolfKills;
} }
virtual void write(ESM::ESMWriter &esm) void write(ESM::ESMWriter &esm) override
{ {
esm.startRecord(ESM::REC_DCOU); esm.startRecord(ESM::REC_DCOU);
for (std::map<std::string, int>::const_iterator it = mKillCounter.begin(); it != mKillCounter.end(); ++it) for (std::map<std::string, int>::const_iterator it = mKillCounter.begin(); it != mKillCounter.end(); ++it)
@ -389,7 +389,7 @@ private:
class ConvertFACT : public Converter class ConvertFACT : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm) void read(ESM::ESMReader& esm) override
{ {
ESM::Faction faction; ESM::Faction faction;
bool isDeleted = false; bool isDeleted = false;
@ -409,7 +409,7 @@ public:
class ConvertSTLN : public Converter class ConvertSTLN : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
std::string itemid = esm.getHNString("NAME"); std::string itemid = esm.getHNString("NAME");
Misc::StringUtils::lowerCaseInPlace(itemid); Misc::StringUtils::lowerCaseInPlace(itemid);
@ -428,7 +428,7 @@ public:
} }
} }
} }
virtual void write(ESM::ESMWriter &esm) void write(ESM::ESMWriter &esm) override
{ {
ESM::StolenItems items; ESM::StolenItems items;
for (std::map<std::string, std::set<Owner> >::const_iterator it = mStolenItems.begin(); it != mStolenItems.end(); ++it) for (std::map<std::string, std::set<Owner> >::const_iterator it = mStolenItems.begin(); it != mStolenItems.end(); ++it)
@ -467,7 +467,7 @@ private:
class ConvertINFO : public Converter class ConvertINFO : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm) void read(ESM::ESMReader& esm) override
{ {
INFO info; INFO info;
info.load(esm); info.load(esm);
@ -477,7 +477,7 @@ public:
class ConvertDIAL : public Converter class ConvertDIAL : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm) void read(ESM::ESMReader& esm) override
{ {
std::string id = esm.getHNString("NAME"); std::string id = esm.getHNString("NAME");
DIAL dial; DIAL dial;
@ -485,7 +485,7 @@ public:
if (dial.mIndex > 0) if (dial.mIndex > 0)
mDials[id] = dial; mDials[id] = dial;
} }
virtual void write(ESM::ESMWriter &esm) void write(ESM::ESMWriter &esm) override
{ {
for (std::map<std::string, DIAL>::const_iterator it = mDials.begin(); it != mDials.end(); ++it) for (std::map<std::string, DIAL>::const_iterator it = mDials.begin(); it != mDials.end(); ++it)
{ {
@ -505,7 +505,7 @@ private:
class ConvertQUES : public Converter class ConvertQUES : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm) void read(ESM::ESMReader& esm) override
{ {
std::string id = esm.getHNString("NAME"); std::string id = esm.getHNString("NAME");
QUES quest; QUES quest;
@ -516,7 +516,7 @@ public:
class ConvertJOUR : public Converter class ConvertJOUR : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm) void read(ESM::ESMReader& esm) override
{ {
JOUR journal; JOUR journal;
journal.load(esm); journal.load(esm);
@ -531,7 +531,7 @@ public:
{ {
} }
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
mGame.load(esm); mGame.load(esm);
mHasGame = true; mHasGame = true;
@ -551,7 +551,7 @@ public:
} }
} }
virtual void write(ESM::ESMWriter &esm) void write(ESM::ESMWriter &esm) override
{ {
if (!mHasGame) if (!mHasGame)
return; return;
@ -578,7 +578,7 @@ private:
class ConvertSCPT : public Converter class ConvertSCPT : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader &esm) void read(ESM::ESMReader &esm) override
{ {
SCPT script; SCPT script;
script.load(esm); script.load(esm);
@ -586,7 +586,7 @@ public:
convertSCPT(script, out); convertSCPT(script, out);
mScripts.push_back(out); mScripts.push_back(out);
} }
virtual void write(ESM::ESMWriter &esm) void write(ESM::ESMWriter &esm) override
{ {
for (const auto & script : mScripts) for (const auto & script : mScripts)
{ {
@ -603,9 +603,9 @@ private:
class ConvertPROJ : public Converter class ConvertPROJ : public Converter
{ {
public: public:
virtual int getStage() override { return 2; } int getStage() override { return 2; }
virtual void read(ESM::ESMReader& esm) override; void read(ESM::ESMReader& esm) override;
virtual void write(ESM::ESMWriter& esm) override; void write(ESM::ESMWriter& esm) override;
private: private:
void convertBaseState(ESM::BaseProjectileState& base, const PROJ::PNAM& pnam); void convertBaseState(ESM::BaseProjectileState& base, const PROJ::PNAM& pnam);
PROJ mProj; PROJ mProj;
@ -614,8 +614,8 @@ private:
class ConvertSPLM : public Converter class ConvertSPLM : public Converter
{ {
public: public:
virtual void read(ESM::ESMReader& esm) override; void read(ESM::ESMReader& esm) override;
virtual void write(ESM::ESMWriter& esm) override; void write(ESM::ESMWriter& esm) override;
private: private:
SPLM mSPLM; SPLM mSPLM;
}; };

@ -86,7 +86,9 @@ namespace ESSImport
bool mHasANIS; bool mHasANIS;
ANIS mANIS; // scripted animation state ANIS mANIS; // scripted animation state
void load(ESM::ESMReader& esm); virtual void load(ESM::ESMReader& esm);
virtual ~ActorData() = default;
}; };
} }

@ -25,7 +25,9 @@ namespace ESSImport
bool mDeleted; bool mDeleted;
void load(ESM::ESMReader& esm); void load(ESM::ESMReader& esm) override;
virtual ~CellRef() = default;
}; };
} }

Loading…
Cancel
Save