2012-12-08 22:27:59 +00:00
|
|
|
#include "mandatoryid.hpp"
|
|
|
|
|
2022-10-19 17:02:00 +00:00
|
|
|
#include <memory>
|
|
|
|
|
2013-06-17 09:42:02 +00:00
|
|
|
#include "../world/collectionbase.hpp"
|
2012-12-08 22:27:59 +00:00
|
|
|
|
2013-06-17 09:42:02 +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>
|
|
|
|
|
2013-06-17 09:42:02 +00:00
|
|
|
CSMTools::MandatoryIdStage::MandatoryIdStage(const CSMWorld::CollectionBase& idCollection,
|
2022-10-06 17:39:46 +00:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2014-12-07 17:57:47 +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())
|
2023-02-20 22:11:18 +00:00
|
|
|
messages.add(mCollectionId, "Missing mandatory record: " + mIds.at(stage).toDebugString());
|
2015-03-11 14:54:45 +00:00
|
|
|
}
|