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:
parent
18a59df050
commit
ad9412a117
@ -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);
|
||||||
|
@ -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())
|
||||||
|
@ -328,32 +328,32 @@ 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
|
||||||
|
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
|
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||||
ammoCount = std::min(ammoCount, ammoNode->getNumChildren());
|
if (!arrowNode->getNumChildren())
|
||||||
|
continue;
|
||||||
|
|
||||||
// Remove existing ammo nodes
|
osg::ref_ptr<osg::Node> arrowChildNode = arrowNode->getChild(0);
|
||||||
for (unsigned int i=0; i<ammoNode->getNumChildren(); ++i)
|
arrowNode->removeChild(arrowChildNode);
|
||||||
{
|
}
|
||||||
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
|
||||||
if (!arrowNode->getNumChildren())
|
|
||||||
continue;
|
|
||||||
|
|
||||||
osg::ref_ptr<osg::Node> arrowChildNode = arrowNode->getChild(0);
|
// Add new ones
|
||||||
arrowNode->removeChild(arrowChildNode);
|
osg::Vec4f glowColor = getEnchantmentColor(*ammo);
|
||||||
}
|
std::string model = ammo->getClass().getModel(*ammo);
|
||||||
|
for (unsigned int i=0; i<ammoCount; ++i)
|
||||||
// Add new ones
|
{
|
||||||
osg::Vec4f glowColor = getEnchantmentColor(*ammo);
|
osg::ref_ptr<osg::Group> arrowNode = ammoNode->getChild(i)->asGroup();
|
||||||
std::string model = ammo->getClass().getModel(*ammo);
|
osg::ref_ptr<osg::Node> arrow = mResourceSystem->getSceneManager()->getInstance(model, arrowNode);
|
||||||
for (unsigned int i=0; i<ammoCount; ++i)
|
if (!ammo->getClass().getEnchantment(*ammo).empty())
|
||||||
{
|
addGlow(arrow, glowColor);
|
||||||
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