1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-24 11:23:52 +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
845 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,
2012-12-08 22:27:59 +00:00
const CSMWorld::UniversalId& collectionId, const std::vector<std::string>& ids)
: 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));
2015-03-11 14:54:45 +00:00
}