forked from mirror/openmw-tes3mp
Add automatic potion naming
This commit is contained in:
parent
7f06e3e7e3
commit
29ac97be7a
4 changed files with 21 additions and 0 deletions
|
@ -173,6 +173,11 @@ namespace MWGui
|
||||||
|
|
||||||
void AlchemyWindow::update()
|
void AlchemyWindow::update()
|
||||||
{
|
{
|
||||||
|
std::string suggestedName = mAlchemy.suggestPotionName();
|
||||||
|
if (suggestedName != mSuggestedPotionName)
|
||||||
|
mNameEdit->setCaptionWithReplacing(suggestedName);
|
||||||
|
mSuggestedPotionName = suggestedName;
|
||||||
|
|
||||||
mSortModel->clearDragItems();
|
mSortModel->clearDragItems();
|
||||||
|
|
||||||
MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy.beginIngredients ();
|
MWMechanics::Alchemy::TIngredientsIterator it = mAlchemy.beginIngredients ();
|
||||||
|
|
|
@ -23,6 +23,8 @@ namespace MWGui
|
||||||
virtual void exit();
|
virtual void exit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
std::string mSuggestedPotionName;
|
||||||
|
|
||||||
ItemView* mItemView;
|
ItemView* mItemView;
|
||||||
SortFilterItemModel* mSortModel;
|
SortFilterItemModel* mSortModel;
|
||||||
|
|
||||||
|
|
|
@ -480,3 +480,14 @@ MWMechanics::Alchemy::Result MWMechanics::Alchemy::create (const std::string& na
|
||||||
|
|
||||||
return Result_Success;
|
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);
|
void removeIngredient (int index);
|
||||||
///< Remove ingredient from slot (calling this function on an empty slot is a no-op).
|
///< 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);
|
Result create (const std::string& name);
|
||||||
///< Try to create a potion from the ingredients, place it in the inventory of the alchemist and
|
///< Try to create a potion from the ingredients, place it in the inventory of the alchemist and
|
||||||
/// adjust the skills of the alchemist accordingly.
|
/// adjust the skills of the alchemist accordingly.
|
||||||
|
|
Loading…
Reference in a new issue