2012-12-08 23:27:59 +01:00
|
|
|
#include "mandatoryid.hpp"
|
|
|
|
|
2013-06-17 11:42:02 +02:00
|
|
|
#include "../world/collectionbase.hpp"
|
2012-12-08 23:27:59 +01:00
|
|
|
|
2013-06-17 11:42:02 +02:00
|
|
|
#include "../world/record.hpp"
|
|
|
|
|
|
|
|
CSMTools::MandatoryIdStage::MandatoryIdStage(const CSMWorld::CollectionBase& idCollection,
|
2012-12-08 23:27:59 +01:00
|
|
|
const CSMWorld::UniversalId& collectionId, const std::vector<std::string>& ids)
|
|
|
|
: mIdCollection(idCollection)
|
|
|
|
, mCollectionId(collectionId)
|
|
|
|
, mIds(ids)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
int CSMTools::MandatoryIdStage::setup()
|
|
|
|
{
|
2021-05-02 10:43:44 +04:00
|
|
|
return static_cast<int>(mIds.size());
|
2012-12-08 23:27:59 +01:00
|
|
|
}
|
|
|
|
|
2014-12-07 18:57:47 +01:00
|
|
|
void CSMTools::MandatoryIdStage::perform(int stage, CSMDoc::Messages& messages)
|
2012-12-08 23:27:59 +01:00
|
|
|
{
|
|
|
|
if (mIdCollection.searchId(mIds.at(stage)) == -1 || mIdCollection.getRecord(mIds.at(stage)).isDeleted())
|
2014-12-07 18:57:47 +01:00
|
|
|
messages.add(mCollectionId, "Missing mandatory record: " + mIds.at(stage));
|
2015-03-11 10:54:45 -04:00
|
|
|
}
|