Don't enchant if the enchantment value is too high for the item

This commit is contained in:
scrawl 2013-03-30 12:54:20 +01:00
parent a359ba6a2f
commit 04673b2f14

View file

@ -158,7 +158,7 @@ namespace MWGui
if(mEnchanting.getGemCharge()==0) if(mEnchanting.getGemCharge()==0)
{ {
mWindowManager.messageBox ("#{sNotifyMessage32}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage32}");
return; return;
} }
@ -222,31 +222,37 @@ namespace MWGui
{ {
if (mEffects.size() <= 0) if (mEffects.size() <= 0)
{ {
mWindowManager.messageBox ("#{sNotifyMessage30}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage30}");
return; return;
} }
if (mName->getCaption ().empty()) if (mName->getCaption ().empty())
{ {
mWindowManager.messageBox ("#{sNotifyMessage10}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage10}");
return; return;
} }
if (boost::lexical_cast<int>(mPrice->getCaption()) > mWindowManager.getInventoryWindow()->getPlayerGold()) if (boost::lexical_cast<int>(mPrice->getCaption()) > mWindowManager.getInventoryWindow()->getPlayerGold())
{ {
mWindowManager.messageBox ("#{sNotifyMessage18}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage18}");
return; return;
} }
if (mEnchanting.soulEmpty()) if (mEnchanting.soulEmpty())
{ {
mWindowManager.messageBox ("#{sNotifyMessage52}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage52}");
return; return;
} }
if (mEnchanting.itemEmpty()) if (mEnchanting.itemEmpty())
{ {
mWindowManager.messageBox ("#{sNotifyMessage11}", std::vector<std::string>()); mWindowManager.messageBox ("#{sNotifyMessage11}");
return;
}
if (mEnchanting.getEnchantCost() > mEnchanting.getMaxEnchantValue())
{
mWindowManager.messageBox ("#{sNotifyMessage29}");
return; return;
} }
@ -254,7 +260,7 @@ namespace MWGui
mEnchanting.setEffect(mEffectList); mEnchanting.setEffect(mEffectList);
mEnchanting.create(); mEnchanting.create();
mWindowManager.messageBox ("#{sEnchantmentMenu12}", std::vector<std::string>()); mWindowManager.messageBox ("#{sEnchantmentMenu12}");
mWindowManager.removeGuiMode (GM_Enchanting); mWindowManager.removeGuiMode (GM_Enchanting);
} }
} }