mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Merge branch 'master' of https://github.com/OpenMW/openmw
This commit is contained in:
commit
8dc20712de
4 changed files with 26 additions and 24 deletions
|
@ -71,6 +71,14 @@ namespace CSMWorld
|
||||||
|
|
||||||
record.load (reader);
|
record.load (reader);
|
||||||
|
|
||||||
|
if (index==-1)
|
||||||
|
{
|
||||||
|
std::string newId = IdAccessorT().getId(record);
|
||||||
|
int newIndex = this->searchId(newId);
|
||||||
|
if (newIndex != -1 && id != newId)
|
||||||
|
index = newIndex;
|
||||||
|
}
|
||||||
|
|
||||||
load (record, base, index);
|
load (record, base, index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,18 +6,20 @@
|
||||||
void CSMWorld::ResourcesManager::addResources (const Resources& resources)
|
void CSMWorld::ResourcesManager::addResources (const Resources& resources)
|
||||||
{
|
{
|
||||||
mResources.insert (std::make_pair (resources.getType(), resources));
|
mResources.insert (std::make_pair (resources.getType(), resources));
|
||||||
|
mResources.insert (std::make_pair (UniversalId::getParentType (resources.getType()),
|
||||||
|
resources));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSMWorld::ResourcesManager::listResources()
|
void CSMWorld::ResourcesManager::listResources()
|
||||||
{
|
{
|
||||||
static const char * const sMeshTypes[] = { "nif", 0 };
|
static const char * const sMeshTypes[] = { "nif", 0 };
|
||||||
|
|
||||||
addResources (Resources ("meshes", UniversalId::Type_Meshes, sMeshTypes));
|
addResources (Resources ("meshes", UniversalId::Type_Mesh, sMeshTypes));
|
||||||
addResources (Resources ("icons", UniversalId::Type_Icons));
|
addResources (Resources ("icons", UniversalId::Type_Icon));
|
||||||
addResources (Resources ("music", UniversalId::Type_Musics));
|
addResources (Resources ("music", UniversalId::Type_Music));
|
||||||
addResources (Resources ("sound", UniversalId::Type_SoundsRes));
|
addResources (Resources ("sound", UniversalId::Type_SoundRes));
|
||||||
addResources (Resources ("textures", UniversalId::Type_Textures));
|
addResources (Resources ("textures", UniversalId::Type_Texture));
|
||||||
addResources (Resources ("videos", UniversalId::Type_Videos));
|
addResources (Resources ("videos", UniversalId::Type_Video));
|
||||||
}
|
}
|
||||||
|
|
||||||
const CSMWorld::Resources& CSMWorld::ResourcesManager::get (UniversalId::Type type) const
|
const CSMWorld::Resources& CSMWorld::ResourcesManager::get (UniversalId::Type type) const
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace MWMechanics
|
||||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
|
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
|
||||||
"fDiseaseXferChance")->getFloat();
|
"fDiseaseXferChance")->getFloat();
|
||||||
|
|
||||||
|
MagicEffects& actorEffects = actor.getClass().getCreatureStats(actor).getMagicEffects();
|
||||||
|
|
||||||
Spells& spells = carrier.getClass().getCreatureStats(carrier).getSpells();
|
Spells& spells = carrier.getClass().getCreatureStats(carrier).getSpells();
|
||||||
for (Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
for (Spells::TIterator it = spells.begin(); it != spells.end(); ++it)
|
||||||
{
|
{
|
||||||
|
@ -33,26 +35,16 @@ namespace MWMechanics
|
||||||
if (actor.getClass().getCreatureStats(actor).getSpells().hasSpell(spell->mId))
|
if (actor.getClass().getCreatureStats(actor).getSpells().hasSpell(spell->mId))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool hasCorprusEffect = false;
|
|
||||||
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = spell->mEffects.mList.begin(); effectIt != spell->mEffects.mList.end(); ++effectIt)
|
|
||||||
{
|
|
||||||
if (effectIt->mEffectID == ESM::MagicEffect::Corprus)
|
|
||||||
{
|
|
||||||
hasCorprusEffect = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float resist = 0.f;
|
float resist = 0.f;
|
||||||
if (hasCorprusEffect)
|
if (spells.hasCorprusEffect(spell))
|
||||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCorprusDisease).getMagnitude()
|
resist = 1.f - 0.01 * (actorEffects.get(ESM::MagicEffect::ResistCorprusDisease).getMagnitude()
|
||||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCorprusDisease).getMagnitude());
|
- actorEffects.get(ESM::MagicEffect::WeaknessToCorprusDisease).getMagnitude());
|
||||||
else if (spell->mData.mType == ESM::Spell::ST_Disease)
|
else if (spell->mData.mType == ESM::Spell::ST_Disease)
|
||||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
|
resist = 1.f - 0.01 * (actorEffects.get(ESM::MagicEffect::ResistCommonDisease).getMagnitude()
|
||||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToCommonDisease).getMagnitude());
|
- actorEffects.get(ESM::MagicEffect::WeaknessToCommonDisease).getMagnitude());
|
||||||
else if (spell->mData.mType == ESM::Spell::ST_Blight)
|
else if (spell->mData.mType == ESM::Spell::ST_Blight)
|
||||||
resist = 1.f - 0.01 * (actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::ResistBlightDisease).getMagnitude()
|
resist = 1.f - 0.01 * (actorEffects.get(ESM::MagicEffect::ResistBlightDisease).getMagnitude()
|
||||||
- actor.getClass().getCreatureStats(actor).getMagicEffects().get(ESM::MagicEffect::WeaknessToBlightDisease).getMagnitude());
|
- actorEffects.get(ESM::MagicEffect::WeaknessToBlightDisease).getMagnitude());
|
||||||
else
|
else
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ namespace MWMechanics
|
||||||
|
|
||||||
TIterator end() const;
|
TIterator end() const;
|
||||||
|
|
||||||
bool hasSpell(const std::string& spell) { return mSpells.find(Misc::StringUtils::lowerCase(spell)) != mSpells.end(); }
|
bool hasSpell(const std::string& spell) const { return mSpells.find(Misc::StringUtils::lowerCase(spell)) != mSpells.end(); }
|
||||||
|
|
||||||
void add (const std::string& spell);
|
void add (const std::string& spell);
|
||||||
///< Adding a spell that is already listed in *this is a no-op.
|
///< Adding a spell that is already listed in *this is a no-op.
|
||||||
|
|
Loading…
Reference in a new issue