mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 20:53:50 +00:00
Merge pull request #2366 from Capostrophic/birthsign
Fix spell deletion for characters without a birthsign
This commit is contained in:
commit
8754db2898
1 changed files with 9 additions and 5 deletions
|
@ -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
|
||||
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);
|
||||
}
|
||||
|
||||
// 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)
|
||||
if (isInherent)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->messageBox("#{sDeleteSpellError}");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue