forked from mirror/openmw-tes3mp
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.
51 lines
1.6 KiB
C++
51 lines
1.6 KiB
C++
#include "regioncheck.hpp"
|
|
|
|
#include <sstream>
|
|
#include <map>
|
|
|
|
#include <components/esm/loadregn.hpp>
|
|
|
|
#include "../prefs/state.hpp"
|
|
|
|
#include "../world/universalid.hpp"
|
|
|
|
CSMTools::RegionCheckStage::RegionCheckStage (const CSMWorld::IdCollection<ESM::Region>& regions)
|
|
: mRegions (regions)
|
|
{
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
}
|
|
|
|
int CSMTools::RegionCheckStage::setup()
|
|
{
|
|
mIgnoreBaseRecords = CSMPrefs::get()["Reports"]["ignore-base-records"].isTrue();
|
|
|
|
return mRegions.getSize();
|
|
}
|
|
|
|
void CSMTools::RegionCheckStage::perform (int stage, CSMDoc::Messages& messages)
|
|
{
|
|
const CSMWorld::Record<ESM::Region>& record = mRegions.getRecord (stage);
|
|
|
|
// Skip "Base" records (setting!) and "Deleted" records
|
|
if ((mIgnoreBaseRecords && record.isBaseOnly()) || record.isDeleted())
|
|
return;
|
|
|
|
const ESM::Region& region = record.get();
|
|
|
|
CSMWorld::UniversalId id (CSMWorld::UniversalId::Type_Region, region.mId);
|
|
|
|
// test for empty name
|
|
if (region.mName.empty())
|
|
messages.add(id, region.mId + " has an empty name", "", CSMDoc::Message::Severity_Error);
|
|
|
|
/// \todo test that the ID in mSleeplist exists
|
|
|
|
// test that chances add up to 100
|
|
int chances = region.mData.mClear + region.mData.mCloudy + region.mData.mFoggy + region.mData.mOvercast +
|
|
region.mData.mRain + region.mData.mThunder + region.mData.mAsh + region.mData.mBlight +
|
|
region.mData.mA + region.mData.mB;
|
|
if (chances != 100)
|
|
messages.add(id, "Weather chances do not add up to 100", "", CSMDoc::Message::Severity_Error);
|
|
|
|
/// \todo check data members that can't be edited in the table view
|
|
}
|