2013-03-25 10:07:04 +00:00
|
|
|
#include "skillcheck.hpp"
|
|
|
|
|
|
|
|
#include <sstream>
|
|
|
|
|
|
|
|
#include <components/esm/loadskil.hpp>
|
|
|
|
|
2018-06-19 22:20:03 +00:00
|
|
|
#include "../prefs/state.hpp"
|
|
|
|
|
2013-03-25 10:07:04 +00:00
|
|
|
#include "../world/universalid.hpp"
|
|
|
|
|
|
|
|
CSMTools::SkillCheckStage::SkillCheckStage (const CSMWorld::IdCollection<ESM::Skill>& skills)
|
|
|
|
: mSkills (skills)
|
2018-06-19 22:20:03 +00:00
|
|
|
{
|
2018-06-20 09:29:38 +00:00
|
|
|
mIgnoreBaseRecords = false;
|
2018-06-19 22:20:03 +00:00
|
|
|
}
|
2013-03-25 10:07:04 +00:00
|
|
|
|
|
|
|
int CSMTools::SkillCheckStage::setup()
|
|
|
|
{
|
2018-06-19 22:20:03 +00:00
|
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
|
|
|
2013-03-25 10:07:04 +00:00
|
|
|
return mSkills.getSize();
|
|
|
|
}
|
|
|
|
|
2014-12-07 17:57:47 +00:00
|
|
|
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);
|
|
|
|
|
2018-06-19 22:20:03 +00:00
|
|
|
// Skip "Base" records (setting!) and "Deleted" records
|
2018-06-20 09:29:38 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
for (int i=0; i<4; ++i)
|
|
|
|
if (skill.mData.mUseValue[i]<0)
|
|
|
|
{
|
|
|
|
std::ostringstream stream;
|
|
|
|
|
2018-08-24 17:13:20 +00:00
|
|
|
stream << "Usage experience value #" << i << " is negative";
|
2013-03-25 10:07:04 +00:00
|
|
|
|
2014-05-08 10:42:29 +00:00
|
|
|
messages.push_back (std::make_pair (id, stream.str()));
|
2013-03-25 10:07:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (skill.mDescription.empty())
|
2018-08-24 17:13:20 +00:00
|
|
|
messages.push_back (std::make_pair (id, "Description is missing"));
|
2015-03-11 14:54:45 +00:00
|
|
|
}
|