mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:19:56 +00:00
Merge remote-tracking branch 'scrawl/enchantment_error'
This commit is contained in:
commit
90036e23b3
2 changed files with 18 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
|||
#include "spellmodel.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -79,8 +81,13 @@ namespace MWGui
|
|||
const std::string enchantId = item.getClass().getEnchantment(item);
|
||||
if (enchantId.empty())
|
||||
continue;
|
||||
const ESM::Enchantment* enchant =
|
||||
esmStore.get<ESM::Enchantment>().find(item.getClass().getEnchantment(item));
|
||||
const ESM::Enchantment* enchant = esmStore.get<ESM::Enchantment>().search(enchantId);
|
||||
if (!enchant)
|
||||
{
|
||||
std::cerr << "Can't find enchantment '" << enchantId << "' on item " << item.getCellRef().getRefId() << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (enchant->mData.mType != ESM::Enchantment::WhenUsed && enchant->mData.mType != ESM::Enchantment::CastOnce)
|
||||
continue;
|
||||
|
||||
|
|
|
@ -645,8 +645,15 @@ void MWWorld::InventoryStore::updateRechargingItems()
|
|||
{
|
||||
if (it->getClass().getEnchantment(*it) != "")
|
||||
{
|
||||
const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(
|
||||
it->getClass().getEnchantment(*it));
|
||||
std::string enchantmentId = it->getClass().getEnchantment(*it);
|
||||
const ESM::Enchantment* enchantment = MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().search(
|
||||
enchantmentId);
|
||||
if (!enchantment)
|
||||
{
|
||||
std::cerr << "Can't find enchantment '" << enchantmentId << "' on item " << it->getCellRef().getRefId() << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (enchantment->mData.mType == ESM::Enchantment::WhenUsed
|
||||
|| enchantment->mData.mType == ESM::Enchantment::WhenStrikes)
|
||||
mRechargingItems.push_back(std::make_pair(it, static_cast<float>(enchantment->mData.mCharge)));
|
||||
|
|
Loading…
Reference in a new issue