1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-10 15:39:02 +00:00
OpenMW/apps/opencs/model/tools/mandatoryid.cpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

30 lines
860 B
C++
Raw Normal View History

2012-12-08 22:27:59 +00:00
#include "mandatoryid.hpp"
2022-10-19 17:02:00 +00:00
#include <memory>
#include "../world/collectionbase.hpp"
2012-12-08 22:27:59 +00:00
#include "../world/record.hpp"
2022-10-19 17:02:00 +00:00
#include <apps/opencs/model/doc/messages.hpp>
#include <apps/opencs/model/world/universalid.hpp>
CSMTools::MandatoryIdStage::MandatoryIdStage(const CSMWorld::CollectionBase& idCollection,
const CSMWorld::UniversalId& collectionId, const std::vector<ESM::RefId>& ids)
2012-12-08 22:27:59 +00:00
: mIdCollection(idCollection)
, mCollectionId(collectionId)
, mIds(ids)
{
}
int CSMTools::MandatoryIdStage::setup()
{
2021-05-02 06:43:44 +00:00
return static_cast<int>(mIds.size());
2012-12-08 22:27:59 +00:00
}
void CSMTools::MandatoryIdStage::perform(int stage, CSMDoc::Messages& messages)
2012-12-08 22:27:59 +00:00
{
if (mIdCollection.searchId(mIds.at(stage)) == -1 || mIdCollection.getRecord(mIds.at(stage)).isDeleted())
messages.add(mCollectionId, "Missing mandatory record: " + mIds.at(stage).toDebugString());
2015-03-11 14:54:45 +00:00
}