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

Added door check with related methods.

This commit is contained in:
Marek Kochanowicz 2013-12-26 12:59:43 +01:00
parent e4e7d50623
commit c1715779fa
4 changed files with 45 additions and 4 deletions

View file

@ -17,7 +17,8 @@ CSMTools::ReferenceableCheckStage::ReferenceableCheckStage(const CSMWorld::RefId
mArmorsSzie(0),
mClothingSize(0),
mContainersSize(0),
mCreaturesSize(0)
mCreaturesSize(0),
mDoorsSize(0)
{
setSizeVariables();
}
@ -32,6 +33,7 @@ void CSMTools::ReferenceableCheckStage::setSizeVariables()
mClothingSize = mReferencables.getClothing().getSize();
mContainersSize = mReferencables.getContainers().getSize();
mCreaturesSize = mReferencables.getCreatures().getSize();
mDoorsSize = mReferencables.getDoors().getSize();
}
void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::string >& messages)
@ -92,6 +94,14 @@ void CSMTools::ReferenceableCheckStage::perform(int stage, std::vector< std::str
}
stage -= mContainersSize;
if (stage < mDoorsSize)
{
doorCheck(stage, mReferencables.getDoors(), messages);
return;
}
stage -= mDoorsSize;
}
int CSMTools::ReferenceableCheckStage::setup()
@ -491,10 +501,32 @@ void CSMTools::ReferenceableCheckStage::creatureCheck(int stage, const CSMWorld:
}
//TODO, find meaning of other values
/*
if (Creature.mData.mGold < 0)
if (Creature.mData.mGold < 0) //It seems that this is for gold in merchant creatures
{
messages.push_back(id.toString() + "|" + Creature.mId + " has negative gold ");
}
*/
}
void CSMTools::ReferenceableCheckStage::doorCheck(int stage, const CSMWorld::RefIdDataContainer< ESM::Door >& records, std::vector< std::string >& messages)
{
const CSMWorld::RecordBase& baserecord = records.getRecord(stage);
if (baserecord.isDeleted())
{
return;
}
const ESM::Door& Door= (static_cast<const CSMWorld::Record<ESM::Door>&>(baserecord)).get();
CSMWorld::UniversalId id(CSMWorld::UniversalId::Type_Door, Door.mId);
//usual, name and model
if (Door.mName.empty())
{
messages.push_back(id.toString() + "|" + Door.mId + " has an empty name");
}
if (Door.mModel.empty())
{
messages.push_back(id.toString() + "|" + Door.mId + " has no model");
}
}

View file

@ -25,6 +25,7 @@ namespace CSMTools
void clothingCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Clothing>& records, std::vector<std::string>& messages);
void containerCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Container>& records, std::vector<std::string>& messages);
void creatureCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Creature>& records, std::vector<std::string>& messages);
void doorCheck(int stage, const CSMWorld::RefIdDataContainer<ESM::Door>& records, std::vector<std::string>& messages);
void setSizeVariables();
@ -39,6 +40,7 @@ namespace CSMTools
int mClothingSize;
int mContainersSize;
int mCreaturesSize;
int mDoorsSize;
};
}
#endif // REFERENCEABLECHECKSTAGE_H

View file

@ -271,3 +271,9 @@ const CSMWorld::RefIdDataContainer< ESM::Creature >& CSMWorld::RefIdData::getCre
{
return mCreatures;
}
const CSMWorld::RefIdDataContainer< ESM::Door >& CSMWorld::RefIdData::getDoors() const
{
return mDoors;
}

View file

@ -229,6 +229,7 @@ namespace CSMWorld
const RefIdDataContainer<ESM::Clothing>& getClothing() const;
const RefIdDataContainer<ESM::Container>& getContainers() const;
const RefIdDataContainer<ESM::Creature>& getCreatures() const;
const RefIdDataContainer<ESM::Door>& getDoors() const;
};
}