From 7fd762145828e0bdbb116d3df3ddc8f8a8c8fabc Mon Sep 17 00:00:00 2001 From: PLkolek Date: Wed, 31 Jul 2013 12:26:34 +0200 Subject: [PATCH 1/2] Fixed area slider in self enchantments. --- apps/openmw/mwgui/spellcreationdialog.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index c4c1be711..165f1975b 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -163,7 +163,7 @@ namespace MWGui mDurationBox->setVisible (true); curY += mDurationBox->getSize().height; } - if (mEffect.mRange == ESM::RT_Target) + if (mEffect.mRange != ESM::RT_Self) { mAreaBox->setPosition(mAreaBox->getPosition().left, curY); mAreaBox->setVisible (true); @@ -182,9 +182,6 @@ namespace MWGui else if (mEffect.mRange == ESM::RT_Touch) mRangeButton->setCaptionWithReplacing ("#{sRangeTouch}"); - mAreaSlider->setVisible (mEffect.mRange != ESM::RT_Self); - mAreaText->setVisible (mEffect.mRange != ESM::RT_Self); - // cycle through range types until we find something that's allowed if (mEffect.mRange == ESM::RT_Target && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTarget)) onRangeButtonClicked(sender); @@ -193,6 +190,11 @@ namespace MWGui if (mEffect.mRange == ESM::RT_Touch && !(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch)) onRangeButtonClicked(sender); + if(mEffect.mRange == ESM::RT_Self) + { + mAreaSlider->setScrollPosition(0); + onAreaChanged(mAreaSlider,0); + } updateBoxes(); } From 8bc8c38f2d1a45930a026120e8690fb9c7578088 Mon Sep 17 00:00:00 2001 From: PLkolek Date: Wed, 31 Jul 2013 13:33:30 +0200 Subject: [PATCH 2/2] Spell cost is updatedon every change in enchanting and spellmaking. --- apps/openmw/mwgui/spellcreationdialog.cpp | 35 ++++++++++++++++------- apps/openmw/mwgui/spellcreationdialog.hpp | 1 + 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 165f1975b..dc86fd825 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -81,6 +81,15 @@ namespace MWGui mDeleteButton->setVisible (false); mEffect.mRange = ESM::RT_Self; + if (!(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastSelf)) + mEffect.mRange = ESM::RT_Touch; + if (!(mMagicEffect->mData.mFlags & ESM::MagicEffect::CastTouch)) + mEffect.mRange = ESM::RT_Target; + mEffect.mMagnMin = 1; + mEffect.mMagnMax = 1; + mEffect.mDuration = 1; + mEffect.mArea = 0; + eventEffectAdded(mEffect); onRangeButtonClicked(mRangeButton); @@ -93,11 +102,6 @@ namespace MWGui mMagnitudeMinValue->setCaption("1"); mMagnitudeMaxValue->setCaption("- 1"); mAreaValue->setCaption("0"); - - mEffect.mMagnMin = 1; - mEffect.mMagnMax = 1; - mEffect.mDuration = 1; - mEffect.mArea = 0; } void EditEffectDialog::editEffect (ESM::ENAMstruct effect) @@ -106,7 +110,7 @@ namespace MWGui MWBase::Environment::get().getWorld()->getStore().get().find(effect.mEffectID); setMagicEffect(magicEffect); - + mOldEffect = effect; mEffect = effect; mEditing = true; @@ -121,6 +125,7 @@ namespace MWGui onMagnitudeMaxChanged (mMagnitudeMinSlider, effect.mMagnMax-1); onAreaChanged (mAreaSlider, effect.mArea); onDurationChanged (mDurationSlider, effect.mDuration-1); + eventEffectModified(mEffect); } void EditEffectDialog::setMagicEffect (const ESM::MagicEffect *effect) @@ -196,6 +201,7 @@ namespace MWGui onAreaChanged(mAreaSlider,0); } updateBoxes(); + eventEffectModified(mEffect); } void EditEffectDialog::onDeleteButtonClicked (MyGUI::Widget* sender) @@ -208,26 +214,27 @@ namespace MWGui void EditEffectDialog::onOkButtonClicked (MyGUI::Widget* sender) { setVisible(false); - - if (mEditing) - eventEffectModified(mEffect); - else - eventEffectAdded(mEffect); } void EditEffectDialog::onCancelButtonClicked (MyGUI::Widget* sender) { setVisible(false); + if(mEditing) + eventEffectModified(mOldEffect); + else + eventEffectRemoved(mEffect); } void EditEffectDialog::setSkill (int skill) { mEffect.mSkill = skill; + eventEffectModified(mEffect); } void EditEffectDialog::setAttribute (int attribute) { mEffect.mAttribute = attribute; + eventEffectModified(mEffect); } void EditEffectDialog::onMagnitudeMinChanged (MyGUI::ScrollBar* sender, size_t pos) @@ -237,6 +244,7 @@ namespace MWGui // trigger the check again (see below) onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition ()); + eventEffectModified(mEffect); } void EditEffectDialog::onMagnitudeMaxChanged (MyGUI::ScrollBar* sender, size_t pos) @@ -252,18 +260,22 @@ namespace MWGui mEffect.mMagnMax = pos+1; mMagnitudeMaxValue->setCaption("- " + boost::lexical_cast(pos+1)); + + eventEffectModified(mEffect); } void EditEffectDialog::onDurationChanged (MyGUI::ScrollBar* sender, size_t pos) { mDurationValue->setCaption(boost::lexical_cast(pos+1)); mEffect.mDuration = pos+1; + eventEffectModified(mEffect); } void EditEffectDialog::onAreaChanged (MyGUI::ScrollBar* sender, size_t pos) { mAreaValue->setCaption(boost::lexical_cast(pos)); mEffect.mArea = pos; + eventEffectModified(mEffect); } // ------------------------------------------------------------------------------------------------ @@ -617,6 +629,7 @@ namespace MWGui void EffectEditorBase::onEffectAdded (ESM::ENAMstruct effect) { mEffects.push_back(effect); + mSelectedEffect=mEffects.size()-1; updateEffectsView(); } diff --git a/apps/openmw/mwgui/spellcreationdialog.hpp b/apps/openmw/mwgui/spellcreationdialog.hpp index 61b888491..e424d7395 100644 --- a/apps/openmw/mwgui/spellcreationdialog.hpp +++ b/apps/openmw/mwgui/spellcreationdialog.hpp @@ -75,6 +75,7 @@ namespace MWGui protected: ESM::ENAMstruct mEffect; + ESM::ENAMstruct mOldEffect; const ESM::MagicEffect* mMagicEffect; };