From 0d3c2ad3f7c41ef1d942a492d192464ab32d7898 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ji=C5=99=C3=AD=20Kune=C5=A1?= Date: Fri, 23 Sep 2016 17:51:17 +0200 Subject: [PATCH] option in settings to allow multiple same spell effects --- apps/openmw/mwgui/spellcreationdialog.cpp | 14 ++++++++++---- apps/openmw/mwgui/spellcreationdialog.hpp | 2 ++ files/settings-default.cfg | 4 ++++ 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 64d4d86c685..bb8800f0aa3 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -5,6 +5,7 @@ #include #include +#include #include "../mwbase/windowmanager.hpp" #include "../mwbase/soundmanager.hpp" @@ -498,6 +499,8 @@ namespace MWGui mAddEffectDialog.eventEffectRemoved += MyGUI::newDelegate(this, &EffectEditorBase::onEffectRemoved); mAddEffectDialog.setVisible (false); + + mUniqueEffectsOnly = Settings::Manager::getBool("unique spell effects", "Game"); } EffectEditorBase::~EffectEditorBase() @@ -638,12 +641,15 @@ namespace MWGui } else { - for (std::vector::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) + if (mUniqueEffectsOnly) { - if (it->mEffectID == mSelectedKnownEffectId) + for (std::vector::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it) { - MWBase::Environment::get().getWindowManager()->messageBox ("#{sOnetypeEffectMessage}"); - return; + if (it->mEffectID == mSelectedKnownEffectId) + { + MWBase::Environment::get().getWindowManager()->messageBox ("#{sOnetypeEffectMessage}"); + return; + } } } diff --git a/apps/openmw/mwgui/spellcreationdialog.hpp b/apps/openmw/mwgui/spellcreationdialog.hpp index 6cdf74d103d..487a7c9a38a 100644 --- a/apps/openmw/mwgui/spellcreationdialog.hpp +++ b/apps/openmw/mwgui/spellcreationdialog.hpp @@ -122,6 +122,8 @@ namespace MWGui std::vector mEffects; + bool mUniqueEffectsOnly; + void onEffectAdded(ESM::ENAMstruct effect); void onEffectModified(ESM::ENAMstruct effect); void onEffectRemoved(ESM::ENAMstruct effect); diff --git a/files/settings-default.cfg b/files/settings-default.cfg index 3d2cd49bfd2..d94ea4ee58c 100644 --- a/files/settings-default.cfg +++ b/files/settings-default.cfg @@ -145,6 +145,10 @@ difficulty = 0 # Show duration of magic effect and lights in the spells window. show effect duration = false +# Do not allow to add same effect multiple times in spell creation +# Example: [fire damage 10pts for 1s]+[fire damage 1-2pts for 10s] is possible if disabled +unique spell effects = true + [General] # Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).