- bugfix when morphing, do a level check to see if the morphed unit should have its level updated based on current kills

This commit is contained in:
Mark Vejvoda 2012-03-25 20:38:05 +00:00
parent d356e5f5de
commit 98351fedba
2 changed files with 9 additions and 1 deletions

View File

@ -2636,6 +2636,10 @@ void Unit::incKills(int team) {
++enemyKills;
}
checkUnitLevel();
}
void Unit::checkUnitLevel() {
const Level *nextLevel= getNextLevel();
if(nextLevel != NULL && enemyKills >= nextLevel->getKills()) {
level= nextLevel;
@ -2680,13 +2684,16 @@ bool Unit::morph(const MorphCommandType *mct){
checkModelStateInfoForNewHpValue();
type= morphUnitType;
level= NULL;
currField=morphUnitField;
computeTotalUpgrade();
map->putUnitCells(this, pos);
faction->applyDiscount(morphUnitType, mct->getDiscount());
faction->addStore(type);
faction->applyStaticProduction(morphUnitType);
level= NULL;
checkUnitLevel();
return true;
}
else{

View File

@ -659,6 +659,7 @@ private:
int getFrameCount() const;
void checkCustomizedParticleTriggers(bool force);
bool checkModelStateInfoForNewHpValue();
void checkUnitLevel();
};
}}// end namespace