mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-28 21:06:41 +00:00
set record count in TES3 header
This commit is contained in:
parent
e4fdebc85b
commit
830530bd06
3 changed files with 38 additions and 1 deletions
|
@ -48,7 +48,10 @@ void CSMDoc::WriteHeaderStage::perform (int stage, std::vector<std::string>& mes
|
||||||
/// \todo fill in missing header information
|
/// \todo fill in missing header information
|
||||||
mState.getWriter().setAuthor ("");
|
mState.getWriter().setAuthor ("");
|
||||||
mState.getWriter().setDescription ("");
|
mState.getWriter().setDescription ("");
|
||||||
mState.getWriter().setRecordCount (0);
|
mState.getWriter().setRecordCount (
|
||||||
|
mDocument.getData().count (CSMWorld::RecordBase::State_Modified) +
|
||||||
|
mDocument.getData().count (CSMWorld::RecordBase::State_ModifiedOnly) +
|
||||||
|
mDocument.getData().count (CSMWorld::RecordBase::State_Deleted));
|
||||||
|
|
||||||
/// \todo refine dependency list (at least remove redundant dependencies)
|
/// \todo refine dependency list (at least remove redundant dependencies)
|
||||||
std::vector<boost::filesystem::path> dependencies = mDocument.getContentFiles();
|
std::vector<boost::filesystem::path> dependencies = mDocument.getContentFiles();
|
||||||
|
|
|
@ -43,6 +43,17 @@ void CSMWorld::Data::appendIds (std::vector<std::string>& ids, const CollectionB
|
||||||
ids.insert (ids.end(), ids2.begin(), ids2.end());
|
ids.insert (ids.end(), ids2.begin(), ids2.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collection)
|
||||||
|
{
|
||||||
|
int number = 0;
|
||||||
|
|
||||||
|
for (int i=0; i<collection.getSize(); ++i)
|
||||||
|
if (collection.getRecord (i).mState==state)
|
||||||
|
++number;
|
||||||
|
|
||||||
|
return number;
|
||||||
|
}
|
||||||
|
|
||||||
CSMWorld::Data::Data() : mRefs (mCells)
|
CSMWorld::Data::Data() : mRefs (mCells)
|
||||||
{
|
{
|
||||||
mGlobals.addColumn (new StringIdColumn<ESM::Global>);
|
mGlobals.addColumn (new StringIdColumn<ESM::Global>);
|
||||||
|
@ -460,6 +471,24 @@ bool CSMWorld::Data::hasId (const std::string& id) const
|
||||||
getReferenceables().searchId (id)!=-1;
|
getReferenceables().searchId (id)!=-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CSMWorld::Data::count (RecordBase::State state) const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
count (state, mGlobals) +
|
||||||
|
count (state, mGmsts) +
|
||||||
|
count (state, mSkills) +
|
||||||
|
count (state, mClasses) +
|
||||||
|
count (state, mFactions) +
|
||||||
|
count (state, mRaces) +
|
||||||
|
count (state, mSounds) +
|
||||||
|
count (state, mScripts) +
|
||||||
|
count (state, mRegions) +
|
||||||
|
count (state, mBirthsigns) +
|
||||||
|
count (state, mSpells) +
|
||||||
|
count (state, mCells) +
|
||||||
|
count (state, mReferenceables);
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
std::vector<std::string> CSMWorld::Data::getIds (bool listDeleted) const
|
||||||
{
|
{
|
||||||
std::vector<std::string> ids;
|
std::vector<std::string> ids;
|
||||||
|
|
|
@ -66,6 +66,8 @@ namespace CSMWorld
|
||||||
bool listDeleted);
|
bool listDeleted);
|
||||||
///< Append all IDs from collection to \a ids.
|
///< Append all IDs from collection to \a ids.
|
||||||
|
|
||||||
|
static int count (RecordBase::State state, const CollectionBase& collection);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Data();
|
Data();
|
||||||
|
@ -151,6 +153,9 @@ namespace CSMWorld
|
||||||
///
|
///
|
||||||
/// \param listDeleted include deleted record in the list
|
/// \param listDeleted include deleted record in the list
|
||||||
|
|
||||||
|
int count (RecordBase::State state) const;
|
||||||
|
///< Return number of top-level records with the given \a state.
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
||||||
void idListChanged();
|
void idListChanged();
|
||||||
|
|
Loading…
Reference in a new issue