mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-29 19:36:43 +00:00
Merge remote-tracking branch 'ragora/conjureditemsgmstcheck'
This commit is contained in:
commit
882ef37ae3
3 changed files with 41 additions and 2 deletions
|
@ -2,6 +2,11 @@
|
||||||
|
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/containerstore.hpp"
|
#include "../mwworld/containerstore.hpp"
|
||||||
|
#include "../mwworld/store.hpp"
|
||||||
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
|
#include "../mwbase/world.hpp"
|
||||||
|
#include "../mwbase/environment.hpp"
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
|
@ -15,6 +20,39 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (base.getClass().getEnchantment(base) != "")
|
if (base.getClass().getEnchantment(base) != "")
|
||||||
mFlags |= Flag_Enchanted;
|
mFlags |= Flag_Enchanted;
|
||||||
|
|
||||||
|
static std::set<std::string> boundItemIDCache;
|
||||||
|
|
||||||
|
// If this is empty then we haven't executed the GMST cache logic yet; or there isn't any sMagicBound* GMST's for some reason
|
||||||
|
if (boundItemIDCache.empty())
|
||||||
|
{
|
||||||
|
// Build a list of known bound item ID's
|
||||||
|
const MWWorld::Store<ESM::GameSetting> &gameSettings = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||||
|
|
||||||
|
for (MWWorld::Store<ESM::GameSetting>::iterator currentIteration = gameSettings.begin(); currentIteration != gameSettings.end(); ++currentIteration)
|
||||||
|
{
|
||||||
|
const ESM::GameSetting ¤tSetting = *currentIteration;
|
||||||
|
std::string currentGMSTID = currentSetting.mId;
|
||||||
|
Misc::StringUtils::toLower(currentGMSTID);
|
||||||
|
|
||||||
|
// Don't bother checking this GMST if it's not a sMagicBound* one.
|
||||||
|
if (currentGMSTID.find("smagicbound") != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// All sMagicBound* GMST's should be of type string
|
||||||
|
std::string currentGMSTValue = currentSetting.getString();
|
||||||
|
Misc::StringUtils::toLower(currentGMSTValue);
|
||||||
|
|
||||||
|
boundItemIDCache.insert(currentGMSTValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform bound item check and assign the Flag_Bound bit if it passes
|
||||||
|
std::string tempItemID = base.getCellRef().getRefId();
|
||||||
|
Misc::StringUtils::toLower(tempItemID);
|
||||||
|
|
||||||
|
if (boundItemIDCache.count(tempItemID) != 0)
|
||||||
|
mFlags |= Flag_Bound;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemStack::ItemStack()
|
ItemStack::ItemStack()
|
||||||
|
|
|
@ -26,7 +26,8 @@ namespace MWGui
|
||||||
|
|
||||||
enum Flags
|
enum Flags
|
||||||
{
|
{
|
||||||
Flag_Enchanted = (1<<0)
|
Flag_Enchanted = (1<<0),
|
||||||
|
Flag_Bound = (1<<1)
|
||||||
};
|
};
|
||||||
int mFlags;
|
int mFlags;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue