From c82df2553cb6397769f1e56ded4845ba71ca5e3c Mon Sep 17 00:00:00 2001 From: Allofich Date: Sun, 20 Nov 2016 23:54:30 +0900 Subject: [PATCH] Allow deleting spells that have the "always succeeds" flag (Fixes #3627) --- apps/openmw/mwgui/spellwindow.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 8422bb33f..7c12a8fc2 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -11,6 +11,7 @@ #include "../mwworld/inventorystore.hpp" #include "../mwworld/class.hpp" #include "../mwworld/esmstore.hpp" +#include "../mwworld/player.hpp" #include "../mwmechanics/spellcasting.hpp" #include "../mwmechanics/spells.hpp" @@ -122,8 +123,15 @@ namespace MWGui const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get().find(spellId); - if (spell->mData.mFlags & ESM::Spell::F_Always - || spell->mData.mType == ESM::Spell::ST_Power) + MWWorld::Ptr player = MWMechanics::getPlayer(); + std::string raceId = player.get()->mBase->mRace; + const std::string& signId = + MWBase::Environment::get().getWorld()->getPlayer().getBirthSign(); + const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get().find(raceId); + const ESM::BirthSign* birthsign = MWBase::Environment::get().getWorld()->getStore().get().find(signId); + + // can't delete racial spells, birthsign spells or powers + if (race->mPowers.exists(spell->mId) || birthsign->mPowers.exists(spell->mId) || spell->mData.mType == ESM::Spell::ST_Power) { MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}"); }