@@ -190,15 +190,12 @@ Real ArmorTemplate::adjustDamage(DamageType t, Real damage, const AsciiString& c
190190 for (CustomDamageTypeVec::const_iterator it = m_customCoefficients.begin (); it != m_customCoefficients.begin (); ++it )
191191 {
192192 if (nameKey == it->first )
193- {
194- damage *= it->second ;
195- return damage;
196- }
193+ return damage *= it->second ;
197194 }
198195
199196 // returns true if found multiplier
200197 DamageType declaredLinkedDamage = DAMAGE_NUM_TYPES;
201- if (TheArmorStore->findNameInTypesList (nameKey, damage, m_customMultCoefficients , declaredLinkedDamage))
198+ if (TheArmorStore->findNameInTypesList (nameKey, damage, m_customCoefficients , declaredLinkedDamage))
202199 {
203200 if (declaredLinkedDamage != DAMAGE_NUM_TYPES)
204201 damage *= m_damageCoefficient[declaredLinkedDamage];
@@ -331,10 +328,9 @@ Real ArmorTemplate::adjustDamage(DamageType t, Real damage, const AsciiString& c
331328 {
332329 // Compatible with ArmorExtend
333330 NameKeyType nameKey = TheNameKeyGenerator->nameToKey ( damageNameStr );
334- CustomDamageTypeVec::iterator it = self->m_customCoefficients .begin ();
335331
336332 Bool hasSet = false ;
337- for (it ; it != self->m_customCoefficients .end (); ++it)
333+ for (CustomDamageTypeVec::iterator it = self-> m_customCoefficients . begin () ; it != self->m_customCoefficients .end (); ++it)
338334 {
339335 if (it->first == nameKey)
340336 {
@@ -381,10 +377,9 @@ void ArmorTemplate::parseArmorMultiplier(INI* ini, void* instance, void* /* stor
381377 else
382378 {
383379 NameKeyType nameKey = TheNameKeyGenerator->nameToKey ( damageNameStr );
384- CustomDamageTypeVec::iterator it = self->m_customMultCoefficients .begin ();
385380
386381 Bool hasSet = false ;
387- for (it ; it != self->m_customMultCoefficients .end (); ++it)
382+ for (CustomDamageTypeVec::iterator it = self-> m_customMultCoefficients . begin () ; it != self->m_customMultCoefficients .end (); ++it)
388383 {
389384 if (it->first == nameKey)
390385 {
@@ -694,15 +689,14 @@ void ArmorStore::parseCustomDamageTypesDefinition(INI* ini)
694689}
695690
696691// -------------------------------------------------------------------------------------------------
697- Bool ArmorStore::findNameInTypesList (NameKeyType nameKey, Real damage, const CustomDamageTypeVec& coefficients, DamageType &linkDamageType)
692+ Bool ArmorStore::findNameInTypesList (NameKeyType nameKey, Real & damage, const CustomDamageTypeVec& coefficients, DamageType &linkDamageType)
698693{
699694 CustomDamageTypesMap::const_iterator it = m_customDamageTypes.find (nameKey);
700695 if (it != m_customDamageTypes.end ())
701696 {
702697 // Find if any of CustomDamageType is assigned with any of the CustomArmor.
703698 // Ignore if the unit does not haven any CustomArmor Coefficient assigned or the Linked Custom Armor List is empty.
704- std::vector<NameKeyType> nameKeyListParent;
705- nameKeyListParent = GetLinkInTypesList (nameKey);
699+ std::vector<NameKeyType> nameKeyListParent = it->second .m_customDamageTypeLink ;
706700 if (!coefficients.empty () && !nameKeyListParent.empty ())
707701 {
708702 // std::vector<NameKeyType> nameKeyListParent;
@@ -716,9 +710,7 @@ Bool ArmorStore::findNameInTypesList(NameKeyType nameKey, Real damage, const Cus
716710 {
717711 // Check if there's a String List that exists for the Child.
718712 // If we do, clear the parents DNA that has been searched and find relative Childs DNA.
719- // nameKeyListParent.clear();
720713 nameKeyListParent = nameKeyListChild;
721- nameKeyListChild.clear ();
722714
723715 // Begin finding the LinkedCustomDamageTypes and see if they are exactly the same as configured Custom Armor List.
724716 for (std::vector<NameKeyType>::const_iterator it2 = nameKeyListParent.begin ();
@@ -729,11 +721,11 @@ Bool ArmorStore::findNameInTypesList(NameKeyType nameKey, Real damage, const Cus
729721 // This is to prevent infinite loop.
730722 // if(nameKeyListChecked[*it2] == 1)
731723 Bool checked = FALSE ;
732- for (std::vector<NameKeyType>::const_iterator str_it = nameKeyListChecked.begin ();
733- str_it != nameKeyListChecked.end ();
734- ++str_it )
724+ for (std::vector<NameKeyType>::const_iterator key_it = nameKeyListChecked.begin ();
725+ key_it != nameKeyListChecked.end ();
726+ ++key_it )
735727 {
736- if ((*str_it ) == (*it2))
728+ if ((*key_it ) == (*it2))
737729 {
738730 checked = TRUE ;
739731 break ;
@@ -786,27 +778,24 @@ Bool ArmorStore::findNameInTypesList(NameKeyType nameKey, Real damage, const Cus
786778}
787779
788780// -------------------------------------------------------------------------------------------------
789- Bool ArmorStore::isNameInTypesList (NameKeyType nameKey) const
781+ /* Bool ArmorStore::isNameInTypesList(NameKeyType nameKey) const
790782{
791783 CustomDamageTypesMap::const_iterator it = m_customDamageTypes.find(nameKey);
792784
793785 // The found the CustomDamageType at the declared CustomDamageTypes data.
794786 if (it != m_customDamageTypes.end())
795- {
796787 return TRUE;
797- }
798- return FALSE ;
799- }
788+ else
789+ return FALSE;
790+ }*/
800791
801792// -------------------------------------------------------------------------------------------------
802793std::vector<NameKeyType> ArmorStore::GetLinkInTypesList (NameKeyType nameKey)
803794{
804795 CustomDamageTypesMap::const_iterator it = m_customDamageTypes.find (nameKey);
805- for (it; it != m_customDamageTypes.end (); ++it)
806- {
807- if (it->first == nameKey)
808- return it->second .m_customDamageTypeLink ;
809- }
796+ if (it != m_customDamageTypes.end ())
797+ return it->second .m_customDamageTypeLink ;
798+
810799 std::vector<NameKeyType> dummyList;
811800 return dummyList;
812801
@@ -819,7 +808,7 @@ std::vector<NameKeyType> ArmorStore::GetLinkInTypesList(NameKeyType nameKey)
819808}
820809
821810// -------------------------------------------------------------------------------------------------
822- DamageType ArmorStore::GetDeclaredLinkDamageType (NameKeyType nameKey)
811+ /* DamageType ArmorStore::GetDeclaredLinkDamageType(NameKeyType nameKey)
823812{
824813 CustomDamageTypesMap::const_iterator it = m_customDamageTypes.find(nameKey);
825814
@@ -847,3 +836,4 @@ Real ArmorStore::GetDeclaredCoefficient(NameKeyType nameKey)
847836 }
848837 return -1.0f;
849838}
839+ */
0 commit comments