1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-06-20 09:11:35 +00:00

Remove some redundant checks

This commit is contained in:
Andrei Kortunov 2019-02-17 11:42:22 +04:00
parent 18a59df050
commit ad9412a117
3 changed files with 25 additions and 25 deletions

View file

@ -780,7 +780,7 @@ namespace MWClass
MWWorld::Ptr armor = ((armorslot != inv.end()) ? *armorslot : MWWorld::Ptr()); MWWorld::Ptr armor = ((armorslot != inv.end()) ? *armorslot : MWWorld::Ptr());
if(!armor.isEmpty() && armor.getTypeName() == typeid(ESM::Armor).name()) if(!armor.isEmpty() && armor.getTypeName() == typeid(ESM::Armor).name())
{ {
if (attacker.isEmpty() || (!attacker.isEmpty() && !(object.isEmpty() && !attacker.getClass().isNpc()))) // Unarmed creature attacks don't affect armor condition if (!object.isEmpty() || attacker.isEmpty() || attacker.getClass().isNpc()) // Unarmed creature attacks don't affect armor condition
{ {
int armorhealth = armor.getClass().getItemHealth(armor); int armorhealth = armor.getClass().getItemHealth(armor);
armorhealth -= std::min(damageDiff, armorhealth); armorhealth -= std::min(damageDiff, armorhealth);

View file

@ -262,7 +262,7 @@ namespace MWGui
if (mode == GM_Console) if (mode == GM_Console)
MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object); MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
else if ((mode == GM_Container) || (mode == GM_Inventory)) else //if ((mode == GM_Container) || (mode == GM_Inventory))
{ {
// pick up object // pick up object
if (!object.isEmpty()) if (!object.isEmpty())

View file

@ -328,8 +328,9 @@ void ActorAnimation::updateQuiver()
suitableAmmo = ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Arrow; suitableAmmo = ammo->get<ESM::Weapon>()->mBase->mData.mType == ESM::Weapon::Arrow;
} }
if (ammoNode && suitableAmmo) if (!suitableAmmo)
{ return;
// We should not show more ammo than equipped and more than quiver mesh has // We should not show more ammo than equipped and more than quiver mesh has
ammoCount = std::min(ammoCount, ammoNode->getNumChildren()); ammoCount = std::min(ammoCount, ammoNode->getNumChildren());
@ -354,7 +355,6 @@ void ActorAnimation::updateQuiver()
if (!ammo->getClass().getEnchantment(*ammo).empty()) if (!ammo->getClass().getEnchantment(*ammo).empty())
addGlow(arrow, glowColor); addGlow(arrow, glowColor);
} }
}
} }
void ActorAnimation::itemAdded(const MWWorld::ConstPtr& item, int /*count*/) void ActorAnimation::itemAdded(const MWWorld::ConstPtr& item, int /*count*/)