1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-24 20:23:53 +00:00
openmw/apps/opencs/model/tools/mandatoryid.cpp
2022-10-31 21:04:01 +01:00

29 lines
845 B
C++

#include "mandatoryid.hpp"
#include <memory>
#include "../world/collectionbase.hpp"
#include "../world/record.hpp"
#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<std::string>& ids)
: mIdCollection(idCollection)
, mCollectionId(collectionId)
, mIds(ids)
{
}
int CSMTools::MandatoryIdStage::setup()
{
return static_cast<int>(mIds.size());
}
void CSMTools::MandatoryIdStage::perform(int stage, CSMDoc::Messages& messages)
{
if (mIdCollection.searchId(mIds.at(stage)) == -1 || mIdCollection.getRecord(mIds.at(stage)).isDeleted())
messages.add(mCollectionId, "Missing mandatory record: " + mIds.at(stage));
}