1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-06 00:55:50 +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());
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);
armorhealth -= std::min(damageDiff, armorhealth);

View File

@ -262,7 +262,7 @@ namespace MWGui
if (mode == GM_Console)
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
if (!object.isEmpty())

View File

@ -328,8 +328,9 @@ void ActorAnimation::updateQuiver()
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
ammoCount = std::min(ammoCount, ammoNode->getNumChildren());
@ -355,7 +356,6 @@ void ActorAnimation::updateQuiver()
addGlow(arrow, glowColor);
}
}
}
void ActorAnimation::itemAdded(const MWWorld::ConstPtr& item, int /*count*/)
{