diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 79e0a4ed7..3c74bcefd 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -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{ diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index a184bc7cd..458766f98 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -659,6 +659,7 @@ private: int getFrameCount() const; void checkCustomizedParticleTriggers(bool force); bool checkModelStateInfoForNewHpValue(); + void checkUnitLevel(); }; }}// end namespace