diff --git a/source/glest_game/types/upgrade_type.cpp b/source/glest_game/types/upgrade_type.cpp index f8bedb900..b2ab4c784 100644 --- a/source/glest_game/types/upgrade_type.cpp +++ b/source/glest_game/types/upgrade_type.cpp @@ -249,13 +249,21 @@ void TotalUpgrade::reset() { void TotalUpgrade::sum(const UpgradeTypeBase *ut) { maxHp+= ut->getMaxHp(); + maxHp = max(0,maxHp); maxEp+= ut->getMaxEp(); + maxEp = max(0,maxEp); sight+= ut->getSight(); + sight = max(0,sight); armor+= ut->getArmor(); + armor = max(0,armor); attackStrength+= ut->getAttackStrength(); + attackStrength = max(0,attackStrength); attackRange+= ut->getAttackRange(); + attackRange = max(0,attackRange); moveSpeed+= ut->getMoveSpeed(); + moveSpeed = max(0,moveSpeed); prodSpeed+= ut->getProdSpeed(); + prodSpeed = max(0,prodSpeed); } void TotalUpgrade::incLevel(const UnitType *ut) {