1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 12:23:53 +00:00

Fix spell deletion for character without a birthsign

This commit is contained in:
Capostrophic 2019-05-04 21:51:36 +03:00
parent 15142a608d
commit 3add9765c3

View file

@ -152,13 +152,17 @@ namespace MWGui
MWWorld::Ptr player = MWMechanics::getPlayer();
std::string raceId = player.get<ESM::NPC>()->mBase->mRace;
const std::string& signId =
MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceId);
const ESM::BirthSign* birthsign = MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().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)
bool isInherent = race->mPowers.exists(spell->mId) || spell->mData.mType == ESM::Spell::ST_Power;
const std::string& signId = MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
if (!isInherent && !signId.empty())
{
const ESM::BirthSign* sign = MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().find(signId);
isInherent = sign->mPowers.exists(spell->mId);
}
if (isInherent)
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}");
}