|
|
|
@ -222,18 +222,19 @@ namespace MWClass
|
|
|
|
|
return ref->mBase->mEnchant;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MWWorld::Ptr Clothing::applyEnchantment(const MWWorld::Ptr &ptr, std::string enchId, int enchCharge, std::string newName) const
|
|
|
|
|
MWWorld::Ptr Clothing::applyEnchantment(const MWWorld::Ptr &ptr, const std::string& enchId, int enchCharge, const std::string& newName) const
|
|
|
|
|
{
|
|
|
|
|
const MWWorld::ESMStore &store = MWBase::Environment::get().getWorld()->getStore();
|
|
|
|
|
ESM::Clothing oldItem = *store.get<ESM::Clothing>().find(ptr.getCellRef().mRefID);
|
|
|
|
|
ESM::Clothing newItem = oldItem;
|
|
|
|
|
MWWorld::LiveCellRef<ESM::Clothing> *ref =
|
|
|
|
|
ptr.get<ESM::Clothing>();
|
|
|
|
|
|
|
|
|
|
ESM::Clothing newItem = *ref->mBase;
|
|
|
|
|
newItem.mId="";
|
|
|
|
|
newItem.mName=newName;
|
|
|
|
|
newItem.mData.mEnchant=enchCharge;
|
|
|
|
|
newItem.mEnchant=enchId;
|
|
|
|
|
const ESM::Clothing *record = MWBase::Environment::get().getWorld()->createRecord (newItem);
|
|
|
|
|
MWWorld::ManualRef ref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
|
|
|
|
return ref.getPtr();
|
|
|
|
|
MWWorld::ManualRef mref (MWBase::Environment::get().getWorld()->getStore(), record->mId);
|
|
|
|
|
return mref.getPtr();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boost::shared_ptr<MWWorld::Action> Clothing::use (const MWWorld::Ptr& ptr) const
|
|
|
|
|