mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-03 17:37:18 +00:00
Remove some redundant checks
This commit is contained in:
parent
18a59df050
commit
ad9412a117
@ -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);
|
||||
|
@ -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())
|
||||
|
@ -328,32 +328,32 @@ 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());
|
||||
|
||||
// Remove existing ammo nodes
|
||||
for (unsigned int i=0; i<ammoNode->getNumChildren(); ++i)
|
||||
{
|
||||
// We should not show more ammo than equipped and more than quiver mesh has
|
||||
ammoCount = std::min(ammoCount, ammoNode->getNumChildren());
|
||||
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||
if (!arrowNode->getNumChildren())
|
||||
continue;
|
||||
|
||||
// Remove existing ammo nodes
|
||||
for (unsigned int i=0; i<ammoNode->getNumChildren(); ++i)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||
if (!arrowNode->getNumChildren())
|
||||
continue;
|
||||
osg::ref_ptr<osg::Node> arrowChildNode = arrowNode->getChild(0);
|
||||
arrowNode->removeChild(arrowChildNode);
|
||||
}
|
||||
|
||||
osg::ref_ptr<osg::Node> arrowChildNode = arrowNode->getChild(0);
|
||||
arrowNode->removeChild(arrowChildNode);
|
||||
}
|
||||
|
||||
// Add new ones
|
||||
osg::Vec4f glowColor = getEnchantmentColor(*ammo);
|
||||
std::string model = ammo->getClass().getModel(*ammo);
|
||||
for (unsigned int i=0; i<ammoCount; ++i)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||
osg::ref_ptr<osg::Node> arrow = mResourceSystem->getSceneManager()->getInstance(model, arrowNode);
|
||||
if (!ammo->getClass().getEnchantment(*ammo).empty())
|
||||
addGlow(arrow, glowColor);
|
||||
}
|
||||
// Add new ones
|
||||
osg::Vec4f glowColor = getEnchantmentColor(*ammo);
|
||||
std::string model = ammo->getClass().getModel(*ammo);
|
||||
for (unsigned int i=0; i<ammoCount; ++i)
|
||||
{
|
||||
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||
osg::ref_ptr<osg::Node> arrow = mResourceSystem->getSceneManager()->getInstance(model, arrowNode);
|
||||
if (!ammo->getClass().getEnchantment(*ammo).empty())
|
||||
addGlow(arrow, glowColor);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user