Enchanting, spellmaking dialog: check for flags when listing known effects

pull/226/head
MiroslavR 10 years ago
parent df262e53ae
commit d16e0c063c

@ -24,7 +24,7 @@ namespace MWGui
EnchantingDialog::EnchantingDialog()
: WindowBase("openmw_enchanting_dialog.layout")
, EffectEditorBase()
, EffectEditorBase(EffectEditorBase::Enchanting)
, mItemSelectionDialog(NULL)
{
getWidget(mName, "NameEdit");

@ -287,7 +287,7 @@ namespace MWGui
SpellCreationDialog::SpellCreationDialog()
: WindowBase("openmw_spellcreation_dialog.layout")
, EffectEditorBase()
, EffectEditorBase(EffectEditorBase::Spellmaking)
{
getWidget(mNameEdit, "NameEdit");
getWidget(mMagickaCost, "MagickaCost");
@ -444,10 +444,11 @@ namespace MWGui
// ------------------------------------------------------------------------------------------------
EffectEditorBase::EffectEditorBase()
EffectEditorBase::EffectEditorBase(Type type)
: mAddEffectDialog()
, mSelectAttributeDialog(NULL)
, mSelectSkillDialog(NULL)
, mType(type)
{
mAddEffectDialog.eventEffectAdded += MyGUI::newDelegate(this, &EffectEditorBase::onEffectAdded);
mAddEffectDialog.eventEffectModified += MyGUI::newDelegate(this, &EffectEditorBase::onEffectModified);
@ -482,6 +483,13 @@ namespace MWGui
const std::vector<ESM::ENAMstruct>& list = spell->mEffects.mList;
for (std::vector<ESM::ENAMstruct>::const_iterator it2 = list.begin(); it2 != list.end(); ++it2)
{
const ESM::MagicEffect * effect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(it2->mEffectID);
// skip effects that do not allow spellmaking/enchanting
int requiredFlags = (mType == Spellmaking) ? ESM::MagicEffect::AllowSpellmaking : ESM::MagicEffect::AllowEnchanting;
if (!(effect->mData.mFlags & requiredFlags))
continue;
if (std::find(knownEffects.begin(), knownEffects.end(), it2->mEffectID) == knownEffects.end())
knownEffects.push_back(it2->mEffectID);
}

@ -85,7 +85,13 @@ namespace MWGui
class EffectEditorBase
{
public:
EffectEditorBase();
enum Type
{
Spellmaking,
Enchanting
};
EffectEditorBase(Type type);
virtual ~EffectEditorBase();
protected:
@ -121,6 +127,9 @@ namespace MWGui
void setWidgets (Widgets::MWList* availableEffectsList, MyGUI::ScrollView* usedEffectsView);
virtual void notifyEffectsChanged () {}
private:
Type mType;
};
class SpellCreationDialog : public WindowBase, public ReferenceInterface, public EffectEditorBase

@ -16,6 +16,7 @@ struct MagicEffect
enum Flags
{
// Hardcoded flags
TargetSkill = 0x1, // Affects a specific skill, which is specified elsewhere in the effect structure.
TargetAttribute = 0x2, // Affects a specific attribute, which is specified elsewhere in the effect structure.
NoDuration = 0x4, // Has no duration. Only runs effect once on cast.
@ -28,7 +29,12 @@ struct MagicEffect
UncappedDamage = 0x1000, // Negates multiple cap behaviours. Allows an effect to reduce an attribute below zero; removes the normal minimum effect duration of 1 second.
NonRecastable = 0x4000, // Does not land if parent spell is already affecting target. Shows "you cannot re-cast" message for self target.
Unreflectable = 0x10000, // Cannot be reflected, the effect always lands normally.
CasterLinked = 0x20000 // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells.
CasterLinked = 0x20000, // Must quench if caster is dead, or not an NPC/creature. Not allowed in containter/door trap spells.
// Moddable flags
AllowSpellmaking = 0x200,
AllowEnchanting = 0x400,
Negative = 0x800 // TODO: needs research
};
enum MagnitudeDisplayType
{

Loading…
Cancel
Save