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

This commit is contained in:
scrawl 2014-12-10 18:05:11 +01:00
parent 619ea846b4
commit 623783cd6a
3 changed files with 6 additions and 6 deletions

View file

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

View file

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

View file

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