Add automatic potion naming

loadfix
scrawl 10 years ago
parent fd7c181e06
commit 192069a181

@ -173,6 +173,11 @@ namespace MWGui
void AlchemyWindow::update()
{
std::string suggestedName = mAlchemy.suggestPotionName();
if (suggestedName != mSuggestedPotionName)
mNameEdit->setCaptionWithReplacing(suggestedName);
mSuggestedPotionName = suggestedName;
mSortModel->clearDragItems();
MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy.beginIngredients ();

@ -23,6 +23,8 @@ namespace MWGui
virtual void exit();
private:
std::string mSuggestedPotionName;
ItemView* mItemView;
SortFilterItemModel* mSortModel;

@ -480,3 +480,14 @@ MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& na
return Result_Success;
}
std::string MWMechanics::Alchemy::suggestPotionName()
{
std::set<MWMechanics::EffectKey> effects = listEffects();
if (effects.empty())
return "";
int effectId = effects.begin()->mId;
return MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
ESM::MagicEffect::effectIdToString(effectId));
}

@ -109,6 +109,9 @@ namespace MWMechanics
void removeIngredient (int index);
///< Remove ingredient from slot (calling this function on an empty slot is a no-op).
std::string suggestPotionName ();
///< Suggest a name for the potion, based on the current effects
Result create (const std::string& name);
///< Try to create a potion from the ingredients, place it in the inventory of the alchemist and
/// adjust the skills of the alchemist accordingly.

Loading…
Cancel
Save