Merge pull request #14 from FreshDumbledore/develop

Start EP can be set
This commit is contained in:
titiger 2014-06-18 23:43:26 +02:00
commit 31def0dc1a
3 changed files with 16 additions and 0 deletions

View File

@ -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() {

View File

@ -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());

View File

@ -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;}