Fix for maxHP upgrades
Fixed the calculation of HP if value is given in percent.
This commit is contained in:
parent
0f4bc361c6
commit
75651f3b2e
|
@ -3578,7 +3578,7 @@ void Unit::applyUpgrade(const UpgradeType *upgradeType){
|
|||
|
||||
checkItemInVault(&this->hp,this->hp);
|
||||
int original_hp = this->hp;
|
||||
this->hp += upgradeType->getMaxHp();
|
||||
this->hp += totalUpgrade.getMaxHp();
|
||||
this->hp = max(0,this->hp);
|
||||
if(original_hp != this->hp) {
|
||||
//printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__);
|
||||
|
|
|
@ -304,11 +304,11 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree,
|
|||
startHpType= stPercentage;
|
||||
}
|
||||
|
||||
// No start value set; use max HP before upgrades
|
||||
// No start value is set; use 100% of the current Max
|
||||
if(!parametersNode->getChild("max-hp")->hasAttribute("start-value") &&
|
||||
!parametersNode->getChild("max-hp")->hasAttribute("start-percentage")) {
|
||||
startHpValue= parametersNode->getChild("max-hp")->getAttribute("value")->getIntValue();
|
||||
startHpType= stValue;
|
||||
startHpPercentage=100;
|
||||
startHpType= stPercentage;
|
||||
}
|
||||
addItemToVault(&(this->startHpPercentage),this->startHpPercentage);
|
||||
|
||||
|
|
Loading…
Reference in New Issue