1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-23 20:23:54 +00:00
openmw/apps/opencs/model/tools/skillcheck.cpp

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

50 lines
1.5 KiB
C++
Raw Normal View History

2013-03-25 10:07:04 +00:00
#include "skillcheck.hpp"
2022-10-19 17:02:00 +00:00
#include <string>
#include "../prefs/state.hpp"
2013-03-25 10:07:04 +00:00
#include "../world/universalid.hpp"
2022-10-19 17:02:00 +00:00
#include <apps/opencs/model/doc/messages.hpp>
#include <apps/opencs/model/prefs/category.hpp>
#include <apps/opencs/model/prefs/setting.hpp>
#include <apps/opencs/model/world/idcollection.hpp>
#include <apps/opencs/model/world/record.hpp>
#include <components/esm3/loadskil.hpp>
2013-03-25 10:07:04 +00:00
CSMTools::SkillCheckStage::SkillCheckStage(const CSMWorld::IdCollection<ESM::Skill>& skills)
: mSkills(skills)
{
mIgnoreBaseRecords = false;
}
2013-03-25 10:07:04 +00:00
int CSMTools::SkillCheckStage::setup()
{
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
2013-03-25 10:07:04 +00:00
return mSkills.getSize();
}
void CSMTools::SkillCheckStage::perform(int stage, CSMDoc::Messages& messages)
2013-03-25 10:07:04 +00:00
{
2013-09-27 08:08:09 +00:00
const CSMWorld::Record<ESM::Skill>& record = mSkills.getRecord(stage);
// Skip "Base" records (setting!) and "Deleted" records
if ((mIgnoreBaseRecords && record.mState == CSMWorld::RecordBase::State_BaseOnly) || record.isDeleted())
2013-09-27 08:08:09 +00:00
return;
const ESM::Skill& skill = record.get();
2013-03-25 10:07:04 +00:00
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Skill, skill.mId);
if (skill.mDescription.empty())
messages.add(id, "Description is missing", "", CSMDoc::Message::Severity_Warning);
2013-03-25 10:07:04 +00:00
for (int i = 0; i < 4; ++i)
if (skill.mData.mUseValue[i] < 0)
{
2018-09-14 18:42:11 +00:00
messages.add(id, "Use value #" + std::to_string(i) + " is negative", "", CSMDoc::Message::Severity_Error);
2013-03-25 10:07:04 +00:00
}
2015-03-11 14:54:45 +00:00
}