mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Optimized getHeroStrength method
- replaced 4x access to bonus system with single access - fixed formula for Diplomacy - fxied formula for hero transfer in campaigns - removed pointless sqrt(pow()) construct
This commit is contained in:
@@ -336,7 +336,7 @@ void CGCreature::setPropertyDer(ObjProperty what, ObjPropertyID identifier)
|
||||
int CGCreature::takenAction(const CGHeroInstance *h, bool allowJoin) const
|
||||
{
|
||||
//calculate relative strength of hero and creatures armies
|
||||
double relStrength = static_cast<double>(h->getTotalStrength()) / getArmyStrength();
|
||||
double relStrength = static_cast<double>(h->getValueForDiplomacy()) / getArmyStrength();
|
||||
|
||||
int powerFactor;
|
||||
if(relStrength >= 7)
|
||||
|
||||
Reference in New Issue
Block a user