mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Add automatic potion naming
This commit is contained in:
parent
7f06e3e7e3
commit
29ac97be7a
@ -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…
x
Reference in New Issue
Block a user