Enchanting: fix cast cost for "on use" enchantments being set incorrectly

pull/397/head
scrawl 10 years ago
parent 619ea846b4
commit 623783cd6a

@ -109,8 +109,8 @@ namespace MWGui
mCharge->setCaption(boost::lexical_cast<std::string>(mEnchanting.getGemCharge()));
std::stringstream castCost;
castCost << std::setprecision(1) << std::fixed << mEnchanting.getCastCost();
mCastCost->setCaption(boost::lexical_cast<std::string>(castCost.str()));
castCost << mEnchanting.getCastCost();
mCastCost->setCaption(castCost.str());
mPrice->setCaption(boost::lexical_cast<std::string>(mEnchanting.getEnchantPrice()));

@ -55,7 +55,7 @@ namespace MWMechanics
enchantment.mData.mCharge = getGemCharge();
enchantment.mData.mAutocalc = 0;
enchantment.mData.mType = mCastStyle;
enchantment.mData.mCost = getEnchantPoints();
enchantment.mData.mCost = getCastCost();
store.remove(mSoulGemPtr, 1, player);
@ -199,7 +199,7 @@ namespace MWMechanics
}
float Enchanting::getCastCost() const
int Enchanting::getCastCost() const
{
if (mCastStyle == ESM::Enchantment::ConstantEffect)
return 0;
@ -215,7 +215,7 @@ namespace MWMechanics
*/
const float castCost = enchantCost - (enchantCost / 100) * (eSkill - 10);
return (castCost < 1) ? 1 : castCost;
return static_cast<int>((castCost < 1) ? 1 : castCost);
}

@ -36,7 +36,7 @@ namespace MWMechanics
void nextCastStyle(); //Set enchant type to next possible type (for mOldItemPtr object)
int getCastStyle() const;
int getEnchantPoints() const;
float getCastCost() const;
int getCastCost() const;
int getEnchantPrice() const;
int getMaxEnchantValue() const;
int getGemCharge() const;

Loading…
Cancel
Save