mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-22 00:23:53 +00:00
Fix spell deletion for character without a birthsign
This commit is contained in:
parent
15142a608d
commit
3add9765c3
1 changed files with 9 additions and 5 deletions
|
@ -152,13 +152,17 @@ namespace MWGui
|
||||||
|
|
||||||
MWWorld::Ptr player = MWMechanics::getPlayer();
|
MWWorld::Ptr player = MWMechanics::getPlayer();
|
||||||
std::string raceId = player.get<ESM::NPC>()->mBase->mRace;
|
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::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
|
// 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}");
|
MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue