mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 03:35:27 +00:00
9d61d76e92
Adds a boolean setting to the user preferences. This setting is locally saved to all OpenMW-CS check stages. When a verification is done, the setting is updated on setup for each check stage. If set to true, the boolean value is then used to skip the verification process for every base record - minus some special cases where, e.g., counters are to be set first. Related issue: - Fixes #4466: Editor: Add option to ignore base records when running verifier (https://gitlab.com/OpenMW/openmw/issues/4466) Tests: The changes were successfully tested in OpenMW-CS by creating faulty "Base" and "Modified" records for every record type (if possible) and, then, running the verifier with and without the option respectively.
59 lines
2.0 KiB
C++
59 lines
2.0 KiB
C++
#include "bodypartcheck.hpp"
|
|
|
|
#include "../prefs/state.hpp"
|
|
|
|
CSMTools::BodyPartCheckStage::BodyPartCheckStage(
|
|
const CSMWorld::IdCollection<ESM::BodyPart> &bodyParts,
|
|
const CSMWorld::Resources &meshes,
|
|
const CSMWorld::IdCollection<ESM::Race> &races ) :
|
|
mBodyParts(bodyParts),
|
|
mMeshes(meshes),
|
|
mRaces(races)
|
|
{
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
}
|
|
|
|
int CSMTools::BodyPartCheckStage::setup()
|
|
{
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
|
|
return mBodyParts.getSize();
|
|
}
|
|
|
|
void CSMTools::BodyPartCheckStage::perform (int stage, CSMDoc::Messages &messages)
|
|
{
|
|
const CSMWorld::Record<ESM::BodyPart> &record = mBodyParts.getRecord(stage);
|
|
|
|
// Skip "Base" records (setting!) and "Deleted" records
|
|
if ((mIgnoreBaseRecords && record.isBaseOnly()) || record.isDeleted())
|
|
return;
|
|
|
|
const ESM::BodyPart &bodyPart = record.get();
|
|
|
|
CSMWorld::UniversalId id( CSMWorld::UniversalId::Type_BodyPart, bodyPart.mId );
|
|
|
|
// Check BYDT
|
|
if (bodyPart.mData.mPart > 14 )
|
|
messages.push_back(std::make_pair( id, bodyPart.mId + " has out of range part value." ));
|
|
|
|
if (bodyPart.mData.mFlags > 3 )
|
|
messages.push_back(std::make_pair( id, bodyPart.mId + " has out of range flags value." ));
|
|
|
|
if (bodyPart.mData.mType > 2 )
|
|
messages.push_back(std::make_pair( id, bodyPart.mId + " has out of range type value." ));
|
|
|
|
// Check MODL
|
|
|
|
if ( bodyPart.mModel.empty() )
|
|
messages.push_back(std::make_pair( id, bodyPart.mId + " has no model." ));
|
|
else if ( mMeshes.searchId( bodyPart.mModel ) == -1 )
|
|
messages.push_back(std::make_pair( id, bodyPart.mId + " has invalid model." ));
|
|
|
|
// Check FNAM
|
|
|
|
if ( bodyPart.mRace.empty() )
|
|
messages.push_back(std::make_pair( id, bodyPart.mId + " has no race." ));
|
|
else if ( mRaces.searchId( bodyPart.mRace ) == -1 )
|
|
messages.push_back(std::make_pair( id, bodyPart.mId + " has invalid race." ));
|
|
}
|