mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
added final check for player npc. Removed useless includes. However, this code spams exceptions and I can't figure out why.
This commit is contained in:
parent
c69814ed14
commit
06f8537087
@ -1,14 +1,6 @@
|
|||||||
#include "referenceablecheck.hpp"
|
#include "referenceablecheck.hpp"
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <map>
|
|
||||||
#include <cassert>
|
|
||||||
#include <boost/graph/graph_concepts.hpp>
|
|
||||||
|
|
||||||
#include "../world/record.hpp"
|
#include "../world/record.hpp"
|
||||||
|
|
||||||
#include "../world/universalid.hpp"
|
#include "../world/universalid.hpp"
|
||||||
#include <components/esm/loadmgef.hpp>
|
|
||||||
|
|
||||||
CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(
|
CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(
|
||||||
const CSMWorld::RefIdData& referenceable, const CSMWorld::IdCollection<ESM::Race >& races,
|
const CSMWorld::RefIdData& referenceable, const CSMWorld::IdCollection<ESM::Race >& races,
|
||||||
@ -18,12 +10,18 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(
|
|||||||
mReferencables(referenceable),
|
mReferencables(referenceable),
|
||||||
mClasses(classes),
|
mClasses(classes),
|
||||||
mRaces(races),
|
mRaces(races),
|
||||||
mFactions(faction)
|
mFactions(faction),
|
||||||
|
mPlayerPresent(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
|
||||||
{
|
{
|
||||||
|
if (stage == mReferencables.getSize() - 1)
|
||||||
|
{
|
||||||
|
finalCheck(messages);
|
||||||
|
}
|
||||||
|
|
||||||
//Checks for books, than, when stage is above mBooksSize goes to other checks, with (stage - PrevSum) as stage.
|
//Checks for books, than, when stage is above mBooksSize goes to other checks, with (stage - PrevSum) as stage.
|
||||||
const int bookSize(mReferencables.getBooks().getSize());
|
const int bookSize(mReferencables.getBooks().getSize());
|
||||||
|
|
||||||
@ -104,7 +102,6 @@ void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::str
|
|||||||
}
|
}
|
||||||
|
|
||||||
stage -= doorSize;
|
stage -= doorSize;
|
||||||
|
|
||||||
const int ingredientSize(mReferencables.getIngredients().getSize());
|
const int ingredientSize(mReferencables.getIngredients().getSize());
|
||||||
|
|
||||||
if (stage < ingredientSize)
|
if (stage < ingredientSize)
|
||||||
@ -296,7 +293,6 @@ void CSMTools::ReferenceableCheckStage::apparatusCheck(
|
|||||||
|
|
||||||
inventoryItemCheck<ESM::Apparatus>(apparatus, messages, id.toString());
|
inventoryItemCheck<ESM::Apparatus>(apparatus, messages, id.toString());
|
||||||
|
|
||||||
//checking for quality, 0 → apparatus is basicly useless, any negative → apparatus is harmfull instead of helpfull
|
|
||||||
toolCheck<ESM::Apparatus>(apparatus, messages, id.toString());
|
toolCheck<ESM::Apparatus>(apparatus, messages, id.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -656,6 +652,12 @@ void CSMTools::ReferenceableCheckStage::npcCheck(
|
|||||||
//Don't know what unknown is for
|
//Don't know what unknown is for
|
||||||
int gold(npc.mNpdt52.mGold);
|
int gold(npc.mNpdt52.mGold);
|
||||||
|
|
||||||
|
//Detect if player is present
|
||||||
|
if (npc.mId == "player")
|
||||||
|
{
|
||||||
|
mPlayerPresent = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (npc.mNpdtType == ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS) //12 = autocalculated
|
if (npc.mNpdtType == ESM::NPC::NPC_WITH_AUTOCALCULATED_STATS) //12 = autocalculated
|
||||||
{
|
{
|
||||||
if ((npc.mFlags & ESM::NPC::Autocalc) == 0) //0x0008 = autocalculated flag
|
if ((npc.mFlags & ESM::NPC::Autocalc) == 0) //0x0008 = autocalculated flag
|
||||||
@ -954,6 +956,19 @@ void CSMTools::ReferenceableCheckStage::staticCheck(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//final check
|
||||||
|
|
||||||
|
void CSMTools::ReferenceableCheckStage::finalCheck(std::vector< std::string >& messages)
|
||||||
|
{
|
||||||
|
if (!mPlayerPresent)
|
||||||
|
{
|
||||||
|
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Npc);
|
||||||
|
messages.push_back(id.toString() + "| There is no player record");
|
||||||
|
}
|
||||||
|
|
||||||
|
mPlayerPresent = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Templates begins here
|
//Templates begins here
|
||||||
|
|
||||||
@ -1022,7 +1037,7 @@ template<typename ITEM> void CSMTools::ReferenceableCheckStage::inventoryItemChe
|
|||||||
messages.push_back(someID + "|" + someItem.mId + " has negative value");
|
messages.push_back(someID + "|" + someItem.mId + " has negative value");
|
||||||
}
|
}
|
||||||
|
|
||||||
//checking for model
|
//checking for model
|
||||||
if (someItem.mModel.empty())
|
if (someItem.mModel.empty())
|
||||||
{
|
{
|
||||||
messages.push_back(someID + "|" + someItem.mId + " has no model");
|
messages.push_back(someID + "|" + someItem.mId + " has no model");
|
||||||
@ -1076,7 +1091,7 @@ template<typename LIST> void CSMTools::ReferenceableCheckStage::listCheck(
|
|||||||
{
|
{
|
||||||
messages.push_back(someID + "|" + someList.mId + " contains item without referencable");
|
messages.push_back(someID + "|" + someList.mId + " contains item without referencable");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (someList.mList[i].mLevel < 1)
|
if (someList.mList[i].mLevel < 1)
|
||||||
{
|
{
|
||||||
messages.push_back(someID + "|" + someList.mId + " contains item with non-positive level");
|
messages.push_back(someID + "|" + someList.mId + " contains item with non-positive level");
|
||||||
|
@ -37,7 +37,10 @@ namespace CSMTools
|
|||||||
void probeCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Probe>& records, std::vector<std::string>& messages);
|
void probeCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Probe>& records, std::vector<std::string>& messages);
|
||||||
void repairCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Repair>& records, std::vector<std::string>& messages);
|
void repairCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Repair>& records, std::vector<std::string>& messages);
|
||||||
void staticCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Static>& records, std::vector<std::string>& messages);
|
void staticCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Static>& records, std::vector<std::string>& messages);
|
||||||
|
|
||||||
|
//FINAL CHECK
|
||||||
|
void finalCheck(std::vector<std::string>& messages);
|
||||||
|
|
||||||
//TEMPLATE CHECKS
|
//TEMPLATE CHECKS
|
||||||
template<typename ITEM> void inventoryItemCheck(const ITEM& someitem, std::vector<std::string>& messages, const std::string& someid, bool enchantable); //for all enchantable items.
|
template<typename ITEM> void inventoryItemCheck(const ITEM& someitem, std::vector<std::string>& messages, const std::string& someid, bool enchantable); //for all enchantable items.
|
||||||
template<typename ITEM> void inventoryItemCheck(const ITEM& someitem, std::vector<std::string>& messages, const std::string& someid); //for non-enchantable items.
|
template<typename ITEM> void inventoryItemCheck(const ITEM& someitem, std::vector<std::string>& messages, const std::string& someid); //for non-enchantable items.
|
||||||
@ -49,6 +52,7 @@ namespace CSMTools
|
|||||||
const CSMWorld::IdCollection<ESM::Race>& mRaces;
|
const CSMWorld::IdCollection<ESM::Race>& mRaces;
|
||||||
const CSMWorld::IdCollection<ESM::Class>& mClasses;
|
const CSMWorld::IdCollection<ESM::Class>& mClasses;
|
||||||
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
const CSMWorld::IdCollection<ESM::Faction>& mFactions;
|
||||||
|
bool mPlayerPresent;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif // REFERENCEABLECHECKSTAGE_H
|
#endif // REFERENCEABLECHECKSTAGE_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user