mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 07:11:36 +00:00
Some refactoring. Remove unused code
(cherry picked from commit 5fd48efd28
)
Conflicts:
apps/openmw/mwworld/store.cpp
This commit is contained in:
parent
b5c958c62a
commit
696f7a942b
6 changed files with 142 additions and 258 deletions
|
@ -3,7 +3,6 @@
|
|||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "defs.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "esmwriter.hpp"
|
||||
#include "defs.hpp"
|
||||
#include "cellid.hpp"
|
||||
#include "util.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -63,7 +62,13 @@ void Cell::load(ESMReader &esm, bool saveContext)
|
|||
void Cell::loadName(ESMReader &esm)
|
||||
{
|
||||
mName = esm.getHNString("NAME");
|
||||
mIsDeleted = readDeleSubRecord(esm);
|
||||
|
||||
mIsDeleted = false;
|
||||
if (esm.isNextSub("DELE"))
|
||||
{
|
||||
esm.skipHSub();
|
||||
mIsDeleted = true;
|
||||
}
|
||||
}
|
||||
|
||||
void Cell::loadCell(ESMReader &esm, bool saveContext)
|
||||
|
@ -126,9 +131,10 @@ void Cell::postLoad(ESMReader &esm)
|
|||
void Cell::save(ESMWriter &esm) const
|
||||
{
|
||||
esm.writeHNCString("NAME", mName);
|
||||
|
||||
if (mIsDeleted)
|
||||
{
|
||||
writeDeleSubRecord(esm);
|
||||
esm.writeHNCString("DELE", "");
|
||||
}
|
||||
|
||||
esm.writeHNT("DATA", mData, 12);
|
||||
|
@ -154,7 +160,7 @@ void Cell::save(ESMWriter &esm) const
|
|||
esm.writeHNT("NAM5", mMapColor);
|
||||
}
|
||||
|
||||
if (mRefNumCounter != 0 && !mIsDeleted)
|
||||
if (mRefNumCounter != 0)
|
||||
esm.writeHNT("NAM0", mRefNumCounter);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ namespace ESM
|
|||
{
|
||||
case ESM::FourCC<'N','A','M','E'>::value:
|
||||
mId = esm.getHString();
|
||||
hasName = true;
|
||||
break;
|
||||
case ESM::FourCC<'D','E','L','E'>::value:
|
||||
esm.skipHSub();
|
||||
|
|
|
@ -26,7 +26,7 @@ namespace ESM
|
|||
{
|
||||
case ESM::FourCC<'N','A','M','E'>::value:
|
||||
mId = esm.getHString();
|
||||
hasName = false;
|
||||
hasName = true;
|
||||
break;
|
||||
case ESM::FourCC<'D','E','L','E'>::value:
|
||||
esm.skipHSub();
|
||||
|
|
|
@ -1,75 +0,0 @@
|
|||
#include "util.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
bool readDeleSubRecord(ESMReader &esm)
|
||||
{
|
||||
if (esm.isNextSub("DELE"))
|
||||
{
|
||||
esm.skipHSub();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void writeDeleSubRecord(ESMWriter &esm)
|
||||
{
|
||||
esm.writeHNT("DELE", static_cast<int32_t>(0));
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<StartScript>(const StartScript &script)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Race>(const Race &race)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<GameSetting>(const GameSetting &gmst)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Skill>(const Skill &skill)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<MagicEffect>(const MagicEffect &mgef)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Pathgrid>(const Pathgrid &pgrd)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Land>(const Land &land)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<DebugProfile>(const DebugProfile &profile)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Filter>(const Filter &filter)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -8,16 +8,6 @@
|
|||
|
||||
#include "esmreader.hpp"
|
||||
#include "esmwriter.hpp"
|
||||
#include "loadsscr.hpp"
|
||||
#include "loadglob.hpp"
|
||||
#include "loadrace.hpp"
|
||||
#include "loadgmst.hpp"
|
||||
#include "loadskil.hpp"
|
||||
#include "loadmgef.hpp"
|
||||
#include "loadland.hpp"
|
||||
#include "loadpgrd.hpp"
|
||||
#include "debugprofile.hpp"
|
||||
#include "filter.hpp"
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -61,43 +51,6 @@ struct Vector3
|
|||
}
|
||||
};
|
||||
|
||||
bool readDeleSubRecord(ESMReader &esm);
|
||||
void writeDeleSubRecord(ESMWriter &esm);
|
||||
|
||||
template <class RecordT>
|
||||
bool isRecordDeleted(const RecordT &record)
|
||||
{
|
||||
return record.mIsDeleted;
|
||||
}
|
||||
|
||||
// The following records can't be deleted (for now)
|
||||
template <>
|
||||
bool isRecordDeleted<StartScript>(const StartScript &script);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Race>(const Race &race);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<GameSetting>(const GameSetting &gmst);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Skill>(const Skill &skill);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<MagicEffect>(const MagicEffect &mgef);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Pathgrid>(const Pathgrid &pgrd);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Land>(const Land &land);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<DebugProfile>(const DebugProfile &profile);
|
||||
|
||||
template <>
|
||||
bool isRecordDeleted<Filter>(const Filter &filter);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue