forked from teamnwah/openmw-tes3coop
correcting
This commit is contained in:
parent
3758fe3834
commit
4a1987ddec
3 changed files with 74 additions and 94 deletions
|
@ -945,18 +945,7 @@ void CSMTools::ReferenceableCheckStage::npcCheck(int stage, const CSMWorld::RefI
|
|||
}
|
||||
else //checking if there is such class
|
||||
{
|
||||
bool nosuchclass(true);
|
||||
|
||||
for (int i = 0; i < mClasses.getSize(); ++i)
|
||||
{
|
||||
if (dynamic_cast<const ESM::Class&>(mClasses.getRecord(i).get()).mId == NPC.mClass)
|
||||
{
|
||||
nosuchclass = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nosuchclass)
|
||||
if (mClasses.searchId(NPC.mClass))
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + NPC.mId + " has invalid class");
|
||||
}
|
||||
|
@ -1002,18 +991,7 @@ void CSMTools::ReferenceableCheckStage::npcCheck(int stage, const CSMWorld::RefI
|
|||
messages.push_back(id.toString() + "|" + NPC.mId + " has negative rank");
|
||||
}
|
||||
|
||||
bool nosuchfaction(true);
|
||||
|
||||
for (int i = 0; i < mFactions.getSize(); ++i)
|
||||
{
|
||||
if (dynamic_cast<const ESM::Faction&>(mFactions.getRecord(i).get()).mId == NPC.mFaction)
|
||||
{
|
||||
nosuchfaction = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (nosuchfaction)
|
||||
if (mFactions.searchId(NPC.mFaction) == -1)
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + NPC.mId + " has invalid faction");
|
||||
}
|
||||
|
@ -1026,7 +1004,7 @@ void CSMTools::ReferenceableCheckStage::npcCheck(int stage, const CSMWorld::RefI
|
|||
|
||||
if (NPC.mHair.empty())
|
||||
{
|
||||
messages.push_back(id.toString() + "|" + NPC.mId + " has no har");
|
||||
messages.push_back(id.toString() + "|" + NPC.mId + " has no hair");
|
||||
}
|
||||
|
||||
//TODO: reputation, Disposition, rank, everything else
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "spellcheck.hpp"
|
||||
#include "referenceablecheck.hpp"
|
||||
|
||||
CSMDoc::Operation* CSMTools::Tools::get(int type)
|
||||
CSMDoc::Operation *CSMTools::Tools::get (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
|
@ -31,60 +31,60 @@ CSMDoc::Operation* CSMTools::Tools::get(int type)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const CSMDoc::Operation* CSMTools::Tools::get(int type) const
|
||||
const CSMDoc::Operation *CSMTools::Tools::get (int type) const
|
||||
{
|
||||
return const_cast<Tools*>(this)->get(type);
|
||||
return const_cast<Tools *> (this)->get (type);
|
||||
}
|
||||
|
||||
CSMDoc::Operation* CSMTools::Tools::getVerifier()
|
||||
CSMDoc::Operation *CSMTools::Tools::getVerifier()
|
||||
{
|
||||
if (!mVerifier)
|
||||
{
|
||||
mVerifier = new CSMDoc::Operation(CSMDoc::State_Verifying, false);
|
||||
mVerifier = new CSMDoc::Operation (CSMDoc::State_Verifying, false);
|
||||
|
||||
connect(mVerifier, SIGNAL(progress(int, int, int)), this, SIGNAL(progress(int, int, int)));
|
||||
connect(mVerifier, SIGNAL(done(int)), this, SIGNAL(done(int)));
|
||||
connect(mVerifier, SIGNAL(reportMessage(const QString&, int)),
|
||||
this, SLOT(verifierMessage(const QString&, int)));
|
||||
connect (mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int)));
|
||||
connect (mVerifier, SIGNAL (done (int)), this, SIGNAL (done (int)));
|
||||
connect (mVerifier, SIGNAL (reportMessage (const QString&, int)),
|
||||
this, SLOT (verifierMessage (const QString&, int)));
|
||||
|
||||
std::vector<std::string> mandatoryIds; // I want C++11, damn it!
|
||||
mandatoryIds.push_back("Day");
|
||||
mandatoryIds.push_back("DaysPassed");
|
||||
mandatoryIds.push_back("GameHour");
|
||||
mandatoryIds.push_back("Month");
|
||||
mandatoryIds.push_back("PCRace");
|
||||
mandatoryIds.push_back("PCVampire");
|
||||
mandatoryIds.push_back("PCWerewolf");
|
||||
mandatoryIds.push_back("PCYear");
|
||||
mandatoryIds.push_back ("Day");
|
||||
mandatoryIds.push_back ("DaysPassed");
|
||||
mandatoryIds.push_back ("GameHour");
|
||||
mandatoryIds.push_back ("Month");
|
||||
mandatoryIds.push_back ("PCRace");
|
||||
mandatoryIds.push_back ("PCVampire");
|
||||
mandatoryIds.push_back ("PCWerewolf");
|
||||
mandatoryIds.push_back ("PCYear");
|
||||
|
||||
mVerifier->appendStage(new MandatoryIdStage(mData.getGlobals(),
|
||||
CSMWorld::UniversalId(CSMWorld::UniversalId::Type_Globals), mandatoryIds));
|
||||
mVerifier->appendStage (new MandatoryIdStage (mData.getGlobals(),
|
||||
CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Globals), mandatoryIds));
|
||||
|
||||
mVerifier->appendStage(new SkillCheckStage(mData.getSkills()));
|
||||
mVerifier->appendStage (new SkillCheckStage (mData.getSkills()));
|
||||
|
||||
mVerifier->appendStage(new ClassCheckStage(mData.getClasses()));
|
||||
mVerifier->appendStage (new ClassCheckStage (mData.getClasses()));
|
||||
|
||||
mVerifier->appendStage(new FactionCheckStage(mData.getFactions()));
|
||||
mVerifier->appendStage (new FactionCheckStage (mData.getFactions()));
|
||||
|
||||
mVerifier->appendStage(new RaceCheckStage(mData.getRaces()));
|
||||
mVerifier->appendStage (new RaceCheckStage (mData.getRaces()));
|
||||
|
||||
mVerifier->appendStage(new SoundCheckStage(mData.getSounds()));
|
||||
mVerifier->appendStage (new SoundCheckStage (mData.getSounds()));
|
||||
|
||||
mVerifier->appendStage(new RegionCheckStage(mData.getRegions()));
|
||||
mVerifier->appendStage (new RegionCheckStage (mData.getRegions()));
|
||||
|
||||
mVerifier->appendStage(new BirthsignCheckStage(mData.getBirthsigns()));
|
||||
mVerifier->appendStage (new BirthsignCheckStage (mData.getBirthsigns()));
|
||||
|
||||
mVerifier->appendStage(new SpellCheckStage(mData.getSpells()));
|
||||
mVerifier->appendStage (new SpellCheckStage (mData.getSpells()));
|
||||
|
||||
mVerifier->appendStage(new ReferenceableCheckStage(mData.getReferenceables().getDataSet(), mData.getRaces(), mData.getClasses(), mData.getFactions()));
|
||||
mVerifier->appendStage (new ReferenceableCheckStage (mData.getReferenceables().getDataSet(), mData.getRaces(), mData.getClasses(), mData.getFactions()));
|
||||
}
|
||||
|
||||
return mVerifier;
|
||||
}
|
||||
|
||||
CSMTools::Tools::Tools(CSMWorld::Data& data) : mData(data), mVerifier(0), mNextReportNumber(0)
|
||||
CSMTools::Tools::Tools (CSMWorld::Data& data) : mData (data), mVerifier (0), mNextReportNumber (0)
|
||||
{
|
||||
for (std::map<int, ReportModel*>::iterator iter(mReports.begin()); iter != mReports.end(); ++iter)
|
||||
for (std::map<int, ReportModel *>::iterator iter (mReports.begin()); iter!=mReports.end(); ++iter)
|
||||
delete iter->second;
|
||||
}
|
||||
|
||||
|
@ -95,17 +95,17 @@ CSMTools::Tools::~Tools()
|
|||
|
||||
CSMWorld::UniversalId CSMTools::Tools::runVerifier()
|
||||
{
|
||||
mReports.insert(std::make_pair(mNextReportNumber++, new ReportModel));
|
||||
mActiveReports[CSMDoc::State_Verifying] = mNextReportNumber - 1;
|
||||
mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel));
|
||||
mActiveReports[CSMDoc::State_Verifying] = mNextReportNumber-1;
|
||||
|
||||
getVerifier()->start();
|
||||
|
||||
return CSMWorld::UniversalId(CSMWorld::UniversalId::Type_VerificationResults, mNextReportNumber - 1);
|
||||
return CSMWorld::UniversalId (CSMWorld::UniversalId::Type_VerificationResults, mNextReportNumber-1);
|
||||
}
|
||||
|
||||
void CSMTools::Tools::abortOperation(int type)
|
||||
void CSMTools::Tools::abortOperation (int type)
|
||||
{
|
||||
if (CSMDoc::Operation* operation = get(type))
|
||||
if (CSMDoc::Operation *operation = get (type))
|
||||
operation->abort();
|
||||
}
|
||||
|
||||
|
@ -113,32 +113,33 @@ int CSMTools::Tools::getRunningOperations() const
|
|||
{
|
||||
static const int sOperations[] =
|
||||
{
|
||||
CSMDoc::State_Verifying,
|
||||
CSMDoc::State_Verifying,
|
||||
-1
|
||||
};
|
||||
|
||||
int result = 0;
|
||||
|
||||
for (int i = 0; sOperations[i] != -1; ++i)
|
||||
if (const CSMDoc::Operation* operation = get(sOperations[i]))
|
||||
for (int i=0; sOperations[i]!=-1; ++i)
|
||||
if (const CSMDoc::Operation *operation = get (sOperations[i]))
|
||||
if (operation->isRunning())
|
||||
result |= sOperations[i];
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
CSMTools::ReportModel* CSMTools::Tools::getReport(const CSMWorld::UniversalId& id)
|
||||
CSMTools::ReportModel *CSMTools::Tools::getReport (const CSMWorld::UniversalId& id)
|
||||
{
|
||||
if (id.getType() != CSMWorld::UniversalId::Type_VerificationResults)
|
||||
throw std::logic_error("invalid request for report model: " + id.toString());
|
||||
if (id.getType()!=CSMWorld::UniversalId::Type_VerificationResults)
|
||||
throw std::logic_error ("invalid request for report model: " + id.toString());
|
||||
|
||||
return mReports.at(id.getIndex());
|
||||
return mReports.at (id.getIndex());
|
||||
}
|
||||
|
||||
void CSMTools::Tools::verifierMessage(const QString& message, int type)
|
||||
void CSMTools::Tools::verifierMessage (const QString& message, int type)
|
||||
{
|
||||
std::map<int, int>::iterator iter = mActiveReports.find(type);
|
||||
std::map<int, int>::iterator iter = mActiveReports.find (type);
|
||||
|
||||
if (iter != mActiveReports.end())
|
||||
mReports[iter->second]->add(message.toStdString());
|
||||
if (iter!=mActiveReports.end())
|
||||
mReports[iter->second]->add (message.toStdString());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ namespace CSMWorld
|
|||
|
||||
public:
|
||||
|
||||
RefIdColumn(int columnId, Display displayType,
|
||||
int flag = Flag_Table | Flag_Dialogue, bool editable = true,
|
||||
bool userEditable = true);
|
||||
RefIdColumn (int columnId, Display displayType,
|
||||
int flag = Flag_Table | Flag_Dialogue, bool editable = true,
|
||||
bool userEditable = true);
|
||||
|
||||
virtual bool isEditable() const;
|
||||
|
||||
|
@ -40,11 +40,11 @@ namespace CSMWorld
|
|||
|
||||
RefIdData mData;
|
||||
std::deque<RefIdColumn> mColumns;
|
||||
std::map<UniversalId::Type, RefIdAdapter*> mAdapters;
|
||||
std::map<UniversalId::Type, RefIdAdapter *> mAdapters;
|
||||
|
||||
private:
|
||||
|
||||
const RefIdAdapter& findAdaptor(UniversalId::Type) const;
|
||||
const RefIdAdapter& findAdaptor (UniversalId::Type) const;
|
||||
///< Throws an exception if no adaptor for \a Type can be found.
|
||||
|
||||
public:
|
||||
|
@ -55,61 +55,62 @@ namespace CSMWorld
|
|||
|
||||
virtual int getSize() const;
|
||||
|
||||
virtual std::string getId(int index) const;
|
||||
virtual std::string getId (int index) const;
|
||||
|
||||
virtual int getIndex(const std::string& id) const;
|
||||
virtual int getIndex (const std::string& id) const;
|
||||
|
||||
virtual int getColumns() const;
|
||||
|
||||
virtual const ColumnBase& getColumn(int column) const;
|
||||
virtual const ColumnBase& getColumn (int column) const;
|
||||
|
||||
virtual QVariant getData(int index, int column) const;
|
||||
virtual QVariant getData (int index, int column) const;
|
||||
|
||||
virtual void setData(int index, int column, const QVariant& data);
|
||||
virtual void setData (int index, int column, const QVariant& data);
|
||||
|
||||
virtual void removeRows(int index, int count);
|
||||
virtual void removeRows (int index, int count);
|
||||
|
||||
virtual void appendBlankRecord(const std::string& id, UniversalId::Type type);
|
||||
virtual void appendBlankRecord (const std::string& id, UniversalId::Type type);
|
||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||
|
||||
virtual int searchId(const std::string& id) const;
|
||||
virtual int searchId (const std::string& id) const;
|
||||
////< Search record with \a id.
|
||||
/// \return index of record (if found) or -1 (not found)
|
||||
|
||||
virtual void replace(int index, const RecordBase& record);
|
||||
virtual void replace (int index, const RecordBase& record);
|
||||
///< If the record type does not match, an exception is thrown.
|
||||
///
|
||||
/// \attention \a record must not change the ID.
|
||||
|
||||
virtual void appendRecord(const RecordBase& record, UniversalId::Type type);
|
||||
virtual void appendRecord (const RecordBase& record, UniversalId::Type type);
|
||||
///< If the record type does not match, an exception is thrown.
|
||||
///
|
||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||
|
||||
virtual const RecordBase& getRecord(const std::string& id) const;
|
||||
virtual const RecordBase& getRecord (const std::string& id) const;
|
||||
|
||||
virtual const RecordBase& getRecord(int index) const;
|
||||
virtual const RecordBase& getRecord (int index) const;
|
||||
|
||||
void load(ESM::ESMReader& reader, bool base, UniversalId::Type type);
|
||||
void load (ESM::ESMReader& reader, bool base, UniversalId::Type type);
|
||||
|
||||
virtual int getAppendIndex(const std::string& id, UniversalId::Type type) const;
|
||||
virtual int getAppendIndex (const std::string& id, UniversalId::Type type) const;
|
||||
///< \param type Will be ignored, unless the collection supports multiple record types
|
||||
|
||||
virtual std::vector<std::string> getIds(bool listDeleted) const;
|
||||
virtual std::vector<std::string> getIds (bool listDeleted) const;
|
||||
///< Return a sorted collection of all IDs
|
||||
///
|
||||
/// \param listDeleted include deleted record in the list
|
||||
|
||||
virtual bool reorderRows(int baseIndex, const std::vector<int>& newOrder);
|
||||
virtual bool reorderRows (int baseIndex, const std::vector<int>& newOrder);
|
||||
///< Reorder the rows [baseIndex, baseIndex+newOrder.size()) according to the indices
|
||||
/// given in \a newOrder (baseIndex+newOrder[0] specifies the new index of row baseIndex).
|
||||
///
|
||||
/// \return Success?
|
||||
|
||||
void save(int index, ESM::ESMWriter& writer) const;
|
||||
void save (int index, ESM::ESMWriter& writer) const;
|
||||
|
||||
const RefIdData& getDataSet() const; //I can't figure out a better name for this one :(
|
||||
const RefIdData& getDataSet() const; //I can't figure out a better name for this one :(
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in a new issue