- more general bugfixes (not all upgrade values were being used in the code)

This commit is contained in:
SoftCoder
2014-12-21 21:07:24 -08:00
parent 3705d56057
commit f97f0ef852
6 changed files with 8 additions and 10 deletions

View File

@@ -8425,7 +8425,7 @@ void Renderer::renderHealthBar(Vec3f v, Unit *unit, float height, bool lineBorde
int barCount=0;
float hp=unit->getHpRatio();
float ep=-1.f;
if(unit->getType()->getMaxEp()!=0){
if(unit->getType()->getTotalMaxEp(unit->getTotalUpgrade()) !=0 ) {
ep=unit->getEpRatio();
numberOfBars++;
}

View File

@@ -482,7 +482,6 @@ MenuStateConnectedGame::MenuStateConnectedGame(Program *program, MainMenu *mainM
buttonPlayNow.init(buttonx, buttony, 125);
buttonPlayNow.setText(lang.getString("PlayNow"));
buttonPlayNow.setVisible(false);
buttonx+=130;
// write hint to console:

View File

@@ -221,7 +221,6 @@ MenuStateCustomGame::MenuStateCustomGame(Program *program, MainMenu *mainMenu,
buttonPlayNow.registerGraphicComponent(containerName,"buttonPlayNow");
buttonPlayNow.init(buttonx, buttony, 125);
buttonx+=130;
labelLocalGameVersion.registerGraphicComponent(containerName,"labelLocalGameVersion");
labelLocalGameVersion.init(10, networkHeadPos+labelOffset);

View File

@@ -1220,7 +1220,7 @@ void Faction::applyCostsOnInterval(const ResourceType *rtApply) {
//decrease unit hp
if(scriptManager->getPlayerModifiers(this->index)->getConsumeEnabled() == true) {
bool decHpResult = unit->decHp(unit->getType()->getMaxHp() / 3);
bool decHpResult = unit->decHp(unit->getType()->getTotalMaxHp(unit->getTotalUpgrade()) / 3);
if(decHpResult) {
unit->setCauseOfDeath(ucodStarvedResource);
world->getStats()->die(unit->getFactionIndex(),unit->getType()->getCountUnitDeathInStats());

View File

@@ -1050,7 +1050,7 @@ float Unit::getEpRatio() const {
throw megaglest_runtime_error(szBuf);
}
if(type->getMaxHp() == 0) {
if(type->getTotalMaxHp(&totalUpgrade) == 0) {
return 0.f;
}
else {
@@ -3199,11 +3199,11 @@ void Unit::tick() {
}
//regenerate hp
else {
if(type->getHpRegeneration() >= 0) {
if(type->getTotalMaxHpRegeneration(&totalUpgrade) >= 0) {
if( currSkill->getClass() != scBeBuilt){
checkItemInVault(&this->hp,this->hp);
int original_hp = this->hp;
this->hp += type->getHpRegeneration();
this->hp += type->getTotalMaxHpRegeneration(&totalUpgrade);
if(this->hp > type->getTotalMaxHp(&totalUpgrade)) {
this->hp = type->getTotalMaxHp(&totalUpgrade);
}
@@ -3220,7 +3220,7 @@ void Unit::tick() {
}
// If we have negative regeneration then check if the unit should die
else {
bool decHpResult = decHp(-type->getHpRegeneration());
bool decHpResult = decHp(-type->getTotalMaxHpRegeneration(&totalUpgrade));
if(decHpResult) {
this->setCauseOfDeath(ucodStarvedRegeneration);
@@ -4262,7 +4262,7 @@ void Unit::checkCustomizedParticleTriggers(bool force) {
}
void Unit::startDamageParticles() {
if(hp < type->getMaxHp() / 2 && hp > 0 && alive == true) {
if(hp < type->getTotalMaxHp(&totalUpgrade) / 2 && hp > 0 && alive == true) {
//start additional particles
if( showUnitParticles &&
type->damageParticleSystemTypes.empty() == false ) {

View File

@@ -1463,7 +1463,7 @@ void TotalUpgrade::deapply(int sourceUnitId, const UpgradeTypeBase *ut,int destU
sourceUnitId,destUnitId,ut->toString().c_str());
for(unsigned int index = 0; index < boostUpgrades.size(); ++index) {
TotalUpgrade *boost = boostUpgrades[index];
printf("\nBoost #%d\n%s\n",index,boost->toString().c_str());
printf("\nBoost #%u\n%s\n",index,boost->toString().c_str());
}
}
}