Don't make unnecessary faction ID searches

0.6.3
Capostrophic 7 years ago committed by Capostrophic
parent 191cc76378
commit 3810ade67a

@ -1000,11 +1000,18 @@ namespace MWMechanics
const OwnerMap& owners = it->second;
const std::string ownerid = ptr.getCellRef().getRefId();
const std::string factionid = ptr.getClass().getPrimaryFaction(ptr);
OwnerMap::const_iterator ownerFound = owners.find(std::make_pair(Misc::StringUtils::lowerCase(ownerid), false));
if (ownerFound != owners.end())
return true;
const std::string factionid = ptr.getClass().getPrimaryFaction(ptr);
if (!factionid.empty())
{
OwnerMap::const_iterator factionOwnerFound = owners.find(std::make_pair(Misc::StringUtils::lowerCase(factionid), true));
return factionOwnerFound != owners.end();
}
return ownerFound != owners.end() || factionOwnerFound != owners.end();
return false;
}
void MechanicsManager::confiscateStolenItemToOwner(const MWWorld::Ptr &player, const MWWorld::Ptr &item, const MWWorld::Ptr& victim, int count)

Loading…
Cancel
Save