Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New option in settings allowing to add multiple identical effects in spellcreation #1076

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions apps/openmw/mwgui/spellcreationdialog.cpp
Expand Up @@ -5,6 +5,7 @@

#include <components/esm/records.hpp>
#include <components/widgets/list.hpp>
#include <components/settings/settings.hpp>

#include "../mwbase/windowmanager.hpp"
#include "../mwbase/soundmanager.hpp"
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -638,12 +641,15 @@ namespace MWGui
}
else
{
for (std::vector<ESM::ENAMstruct>::const_iterator it = mEffects.begin(); it != mEffects.end(); ++it)
if (mUniqueEffectsOnly)
{
if (it->mEffectID == mSelectedKnownEffectId)
for (std::vector<ESM::ENAMstruct>::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;
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions apps/openmw/mwgui/spellcreationdialog.hpp
Expand Up @@ -122,6 +122,8 @@ namespace MWGui

std::vector<ESM::ENAMstruct> mEffects;

bool mUniqueEffectsOnly;

void onEffectAdded(ESM::ENAMstruct effect);
void onEffectModified(ESM::ENAMstruct effect);
void onEffectRemoved(ESM::ENAMstruct effect);
Expand Down
4 changes: 4 additions & 0 deletions files/settings-default.cfg
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, this option must be named to be false by default. E.g. you have settings-default.cfg v0.35.0 already installed without unique spell effects in it, you download a new v0.41.0 which requires this option to be set by default to true, but there is no any... The game logic is changed. Ooops

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True - vanilla version, that does not allow multiple identical magic effects
False - version that allows multiple identical magic effects

So, that shouldn't be a problem, since it defaults to vanilla behavior. (and settings-default.cfg is replaced when updating openmw)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. If one still has 0.35 settings-default.cfg, that means they have installed 0.41 improperly.

Also, Settings::Manager::getBool("unique spell effects", "Game") will throw, not return false, when the option is missing:

    throw std::runtime_error(std::string("Trying to retrieve a non-existing setting: ") + setting
                             + ".\nMake sure the settings-default.cfg file was properly installed.");


[General]

# Anisotropy reduces distortion in textures at low angles (e.g. 0 to 16).
Expand Down