- bugfix for upgrades (don't allow negative sums for each attribute)

This commit is contained in:
Mark Vejvoda 2011-06-26 02:58:34 +00:00
parent 5e67b505a7
commit fd8ed536bb

View File

@ -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) {