1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-21 21:39:40 +00:00

Move the user preference check to the preparation step before the running of the operation.

This commit is contained in:
cc9cii 2015-05-29 06:40:40 +10:00
parent 00c165d3a5
commit 734e52d1c8
2 changed files with 13 additions and 15 deletions

View file

@ -16,17 +16,14 @@ CSMTools::PathgridCheckStage::PathgridCheckStage (const CSMWorld::SubCellCollect
int CSMTools::PathgridCheckStage::setup() int CSMTools::PathgridCheckStage::setup()
{ {
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
mExtraCheck = userSettings.setting ("verifier/pathgrid-extra-check", QString ("false"))=="true";
return mPathgrids.getSize(); return mPathgrids.getSize();
} }
void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& messages) void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& messages)
{ {
// NOTE: This is horribly inefficient but in order to use signals the entire Stage class
// hierarchy needs to be braught under Qt which seems like an overkill for a small
// performance gain during verify operations
CSMSettings::UserSettings &userSettings = CSMSettings::UserSettings::instance();
bool extraCheck = userSettings.setting ("verifier/pathgrid-extra-check", QString ("false"))=="true";
const CSMWorld::Record<CSMWorld::Pathgrid>& record = mPathgrids.getRecord (stage); const CSMWorld::Record<CSMWorld::Pathgrid>& record = mPathgrids.getRecord (stage);
if (record.isDeleted()) if (record.isDeleted())
@ -113,7 +110,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
} }
} }
if (!extraCheck) if (!mExtraCheck)
continue; continue;
// check duplicate points // check duplicate points
@ -144,7 +141,7 @@ void CSMTools::PathgridCheckStage::perform (int stage, CSMDoc::Messages& message
} }
} }
if (!extraCheck) if (!mExtraCheck)
return; return;
// check pathgrid points that are not connected to anything // check pathgrid points that are not connected to anything

View file

@ -24,17 +24,18 @@ namespace CSMTools
class PathgridCheckStage : public CSMDoc::Stage class PathgridCheckStage : public CSMDoc::Stage
{ {
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid, bool mExtraCheck;
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& mPathgrids; const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& mPathgrids;
public: public:
PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid, PathgridCheckStage (const CSMWorld::SubCellCollection<CSMWorld::Pathgrid,
CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& pathgrids); CSMWorld::IdAccessor<CSMWorld::Pathgrid> >& pathgrids);
virtual int setup(); virtual int setup();
virtual void perform (int stage, CSMDoc::Messages& messages); virtual void perform (int stage, CSMDoc::Messages& messages);
}; };
} }