diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 728d7fed..7042c4ee 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -1958,6 +1958,10 @@ void Unit::born(const CommandType *ct) { //printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); } addItemToVault(&this->hp,this->hp); + + //set ep from start-ep tag + checkItemInVault(&this->ep,this->ep); + this->ep= type->getStartEp(); } void Unit::kill() { diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index 846a4a9e..5eac779e 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -126,6 +126,7 @@ UnitType::UnitType() : ProducibleType() { maxUnitCount= 0; maxHp=0; maxEp=0; + startEp=0; armor=0; sight=0; size=0; @@ -247,6 +248,14 @@ void UnitType::loaddd(int id,const string &dir, const TechTree *techTree, } addItemToVault(&(this->epRegeneration),this->epRegeneration); + //startEp + + if(parametersNode->hasChild("start-ep")) { + //checkItemInVault(&(this->startEp),this->startEp); + startEp= parametersNode->getChild("start-ep")->getAttribute("value")->getIntValue(); + } + addItemToVault(&(this->startEp),this->startEp); + //maxUnitCount if(parametersNode->hasChild("max-unit-count")) { //checkItemInVault(&(this->maxUnitCount),this->maxUnitCount); @@ -1100,6 +1109,7 @@ std::string UnitType::toString() const { result += " maxHp = " + intToStr(maxHp); result += " hpRegeneration = " + intToStr(hpRegeneration); result += " maxEp = " + intToStr(maxEp); + result += " startEp = " + intToStr(startEp); result += " epRegeneration = " + intToStr(epRegeneration); result += " maxUnitCount = " + intToStr(getMaxUnitCount()); diff --git a/source/glest_game/types/unit_type.h b/source/glest_game/types/unit_type.h index 2f437527..ee23d111 100644 --- a/source/glest_game/types/unit_type.h +++ b/source/glest_game/types/unit_type.h @@ -106,6 +106,7 @@ private: int maxHp; int hpRegeneration; int maxEp; + int startEp; int epRegeneration; int maxUnitCount; @@ -180,6 +181,7 @@ public: inline int getHpRegeneration() const {return hpRegeneration;} inline int getMaxEp() const {return maxEp;} inline int getEpRegeneration() const {return epRegeneration;} + inline int getStartEp() const {return startEp;} inline int getMaxUnitCount() const {return maxUnitCount;} inline bool getField(Field field) const {return fields[field];} inline Field getField() const {return field;}