- added name to attack-boosts and shared attack boosts per unit type

This commit is contained in:
Mark Vejvoda 2011-11-11 04:17:55 +00:00
parent 0b62b4137e
commit 0039354c15
6 changed files with 172 additions and 107 deletions

View File

@ -1875,7 +1875,7 @@ bool Unit::unitHasAttackBoost(const AttackBoost *boost, const Unit *source) cons
bool result = false; bool result = false;
for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) { for(unsigned int i = 0; i < currentAttackBoostEffects.size(); ++i) {
const UnitAttackBoostEffect *effect = currentAttackBoostEffects[i]; const UnitAttackBoostEffect *effect = currentAttackBoostEffects[i];
if( effect != NULL && effect->boost == boost && if( effect != NULL && effect->boost->name == boost->name &&
effect->source->getType()->getId() == source->getType()->getId()) { effect->source->getType()->getId() == source->getType()->getId()) {
result = true; result = true;
break; break;

View File

@ -28,6 +28,7 @@ using namespace Shared::Graphics;
namespace Glest{ namespace Game{ namespace Glest{ namespace Game{
int SkillType::nextAttackBoostId = 0;
AttackBoost::AttackBoost() { AttackBoost::AttackBoost() {
enabled = false; enabled = false;
@ -163,8 +164,115 @@ SkillType::~SkillType() {
} }
} }
void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, const XmlNode * SkillType::findAttackBoostDetails(string attackBoostName,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const XmlNode *attackBoostsNode,const XmlNode *attackBoostNode) {
const XmlNode *result = attackBoostNode;
if(attackBoostsNode != NULL && attackBoostName != "") {
for(int i = 0; i < attackBoostsNode->getChildCount(); ++i) {
const XmlNode *abn= attackBoostsNode->getChild("attack-boost", i);
string sharedName = abn->getAttribute("name")->getRestrictedValue();
if(sharedName == attackBoostName) {
result = abn;
break;
}
}
}
return result;
}
void SkillType::loadAttackBoost(const XmlNode *attackBoostsNode, const XmlNode *attackBoostNode,
const FactionType *ft, string parentLoader, const string & dir,
string currentPath, std::map<string,vector<pair<string,string> > > & loadedFileList,
const TechTree *tt) {
attackBoost.enabled = true;
if(attackBoostNode->hasAttribute("name") == true) {
attackBoost.name = attackBoostNode->getAttribute("name")->getRestrictedValue();
attackBoostNode = findAttackBoostDetails(attackBoost.name,attackBoostsNode,attackBoostNode);
}
else {
attackBoost.name = "attack-boost-autoname-" + intToStr(getNextAttackBoostId());
}
string targetType = attackBoostNode->getChild("target")->getAttribute("value")->getValue();
attackBoost.allowMultipleBoosts = attackBoostNode->getChild("allow-multiple-boosts")->getAttribute("value")->getBoolValue();
attackBoost.radius = attackBoostNode->getChild("radius")->getAttribute("value")->getIntValue();
attackBoost.includeSelf = false;
if(attackBoostNode->getChild("target")->hasAttribute("include-self") == true) {
attackBoost.includeSelf = attackBoostNode->getChild("target")->getAttribute("include-self")->getBoolValue();
}
if(targetType == "ally") {
attackBoost.targetType = abtAlly;
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "foe") {
attackBoost.targetType = abtFoe;
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "faction") {
attackBoost.targetType = abtFaction;
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "unit-types") {
attackBoost.targetType = abtUnitTypes;
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "all") {
attackBoost.targetType = abtAll;
for(int i = 0;i < attackBoostNode->getChild("target")->getChildCount();++i) {
const XmlNode *boostUnitNode = attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else {
char szBuf[4096] = "";
sprintf(szBuf, "Unsupported target [%s] specified for attack boost for skill [%s] in [%s]", targetType.c_str(), name.c_str(), parentLoader.c_str());
throw runtime_error(szBuf);
}
attackBoost.boostUpgrade.load(attackBoostNode);
if(attackBoostNode->hasChild("particles") == true) {
const XmlNode *particleNode = attackBoostNode->getChild("particles");
bool particleEnabled = particleNode->getAttribute("value")->getBoolValue();
if(particleEnabled == true) {
if(particleNode->hasChild("originator-particle-file") == true){
const XmlNode *particleFileNode = particleNode->getChild("originator-particle-file");
string path = particleFileNode->getAttribute("path")->getRestrictedValue();
attackBoost.unitParticleSystemTypeForSourceUnit = new UnitParticleSystemType();
attackBoost.unitParticleSystemTypeForSourceUnit->load(particleFileNode, dir, currentPath + path, &Renderer::getInstance(), loadedFileList, parentLoader, tt->getPath());
loadedFileList[currentPath + path].push_back(make_pair(parentLoader, particleFileNode->getAttribute("path")->getRestrictedValue()));
}
if(particleNode->hasChild("affected-particle-file") == true) {
const XmlNode *particleFileNode = particleNode->getChild("affected-particle-file");
string path = particleFileNode->getAttribute("path")->getRestrictedValue();
attackBoost.unitParticleSystemTypeForAffectedUnit = new UnitParticleSystemType();
attackBoost.unitParticleSystemTypeForAffectedUnit->load(particleFileNode, dir, currentPath + path, &Renderer::getInstance(), loadedFileList, parentLoader, tt->getPath());
loadedFileList[currentPath + path].push_back(make_pair(parentLoader, particleFileNode->getAttribute("path")->getRestrictedValue()));
}
}
}
}
void SkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
const string &dir, const TechTree *tt, const FactionType *ft,
std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader) { string parentLoader) {
//name //name
name= sn->getChild("name")->getAttribute("value")->getRestrictedValue(); name= sn->getChild("name")->getAttribute("value")->getRestrictedValue();
@ -272,91 +380,8 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
// attack-boost // attack-boost
if(sn->hasChild("attack-boost") == true) { if(sn->hasChild("attack-boost") == true) {
//printf("$$FOUND ATTACK BOOST FOR [%s]\n",parentLoader.c_str()); //printf("$$FOUND ATTACK BOOST FOR [%s]\n",parentLoader.c_str());
attackBoost.enabled = true;
const XmlNode *attackBoostNode = sn->getChild("attack-boost"); const XmlNode *attackBoostNode = sn->getChild("attack-boost");
string targetType = attackBoostNode->getChild("target")->getAttribute("value")->getValue(); loadAttackBoost(attackBoostsNode, attackBoostNode, ft, parentLoader, dir, currentPath, loadedFileList, tt);
attackBoost.allowMultipleBoosts = attackBoostNode->getChild("allow-multiple-boosts")->getAttribute("value")->getBoolValue();
attackBoost.radius = attackBoostNode->getChild("radius")->getAttribute("value")->getIntValue();
attackBoost.includeSelf = false;
if(attackBoostNode->getChild("target")->hasAttribute("include-self") == true) {
attackBoost.includeSelf = attackBoostNode->getChild("target")->getAttribute("include-self")->getBoolValue();
}
if(targetType == "ally") {
attackBoost.targetType = abtAlly;
for(int i = 0; i < attackBoostNode->getChild("target")->getChildCount(); ++i) {
const XmlNode *boostUnitNode= attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "foe") {
attackBoost.targetType = abtFoe;
for(int i = 0; i < attackBoostNode->getChild("target")->getChildCount(); ++i) {
const XmlNode *boostUnitNode= attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "faction") {
attackBoost.targetType = abtFaction;
for(int i = 0; i < attackBoostNode->getChild("target")->getChildCount(); ++i) {
const XmlNode *boostUnitNode= attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "unit-types") {
attackBoost.targetType = abtUnitTypes;
for(int i = 0; i < attackBoostNode->getChild("target")->getChildCount(); ++i) {
const XmlNode *boostUnitNode= attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else if(targetType == "all") {
attackBoost.targetType = abtAll;
for(int i = 0; i < attackBoostNode->getChild("target")->getChildCount(); ++i) {
const XmlNode *boostUnitNode= attackBoostNode->getChild("target")->getChild("unit-type", i);
attackBoost.boostUnitList.push_back(ft->getUnitType(boostUnitNode->getAttribute("name")->getRestrictedValue()));
}
}
else {
char szBuf[4096]="";
sprintf(szBuf,"Unsupported target [%s] specified for attack boost for skill [%s] in [%s]",targetType.c_str(),name.c_str(),parentLoader.c_str());
throw runtime_error(szBuf);
}
attackBoost.boostUpgrade.load(attackBoostNode);
//particles
if(attackBoostNode->hasChild("particles") == true) {
const XmlNode *particleNode= attackBoostNode->getChild("particles");
bool particleEnabled= particleNode->getAttribute("value")->getBoolValue();
if(particleEnabled == true) {
if(particleNode->hasChild("originator-particle-file") == true) {
const XmlNode *particleFileNode= particleNode->getChild("originator-particle-file");
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
attackBoost.unitParticleSystemTypeForSourceUnit = new UnitParticleSystemType();
attackBoost.unitParticleSystemTypeForSourceUnit->load(particleFileNode, dir, currentPath + path, &Renderer::getInstance(),
loadedFileList,parentLoader,tt->getPath());
loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleFileNode->getAttribute("path")->getRestrictedValue()));
}
if(particleNode->hasChild("affected-particle-file") == true) {
const XmlNode *particleFileNode= particleNode->getChild("affected-particle-file");
string path= particleFileNode->getAttribute("path")->getRestrictedValue();
attackBoost.unitParticleSystemTypeForAffectedUnit = new UnitParticleSystemType();
attackBoost.unitParticleSystemTypeForAffectedUnit->load(particleFileNode, dir, currentPath + path, &Renderer::getInstance(),
loadedFileList,parentLoader,tt->getPath());
loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleFileNode->getAttribute("path")->getRestrictedValue()));
}
}
}
} }
} }
@ -534,10 +559,11 @@ AttackSkillType::~AttackSkillType() {
deleteValues(projSounds.getSounds().begin(), projSounds.getSounds().end()); deleteValues(projSounds.getSounds().begin(), projSounds.getSounds().end());
} }
void AttackSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader) { string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader); SkillType::load(sn, attackBoostsNode,dir, tt, ft, loadedFileList, parentLoader);
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
@ -697,10 +723,11 @@ ProduceSkillType::ProduceSkillType(){
animProgressBound=false; animProgressBound=false;
} }
void ProduceSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void ProduceSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader) { string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader); SkillType::load(sn, attackBoostsNode,dir, tt, ft, loadedFileList, parentLoader);
if(sn->hasChild("anim-progress-bound")){ if(sn->hasChild("anim-progress-bound")){
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue(); animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
@ -730,10 +757,11 @@ UpgradeSkillType::UpgradeSkillType(){
animProgressBound=false; animProgressBound=false;
} }
void UpgradeSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void UpgradeSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader) { string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader); SkillType::load(sn, attackBoostsNode,dir, tt, ft, loadedFileList, parentLoader);
if(sn->hasChild("anim-progress-bound")){ if(sn->hasChild("anim-progress-bound")){
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue(); animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
@ -762,10 +790,11 @@ BeBuiltSkillType::BeBuiltSkillType(){
animProgressBound=false; animProgressBound=false;
} }
void BeBuiltSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void BeBuiltSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader) { string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader); SkillType::load(sn, attackBoostsNode,dir, tt, ft, loadedFileList, parentLoader);
if(sn->hasChild("anim-progress-bound")){ if(sn->hasChild("anim-progress-bound")){
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue(); animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
@ -792,10 +821,11 @@ MorphSkillType::MorphSkillType(){
animProgressBound=false; animProgressBound=false;
} }
void MorphSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void MorphSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader) { string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader); SkillType::load(sn, attackBoostsNode,dir, tt, ft, loadedFileList, parentLoader);
if(sn->hasChild("anim-progress-bound")){ if(sn->hasChild("anim-progress-bound")){
animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue(); animProgressBound= sn->getChild("anim-progress-bound")->getAttribute("value")->getBoolValue();
@ -824,10 +854,11 @@ DieSkillType::DieSkillType(){
fade=false; fade=false;
} }
void DieSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void DieSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader) { string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader); SkillType::load(sn, attackBoostsNode,dir, tt, ft, loadedFileList, parentLoader);
fade= sn->getChild("fade")->getAttribute("value")->getBoolValue(); fade= sn->getChild("fade")->getAttribute("value")->getBoolValue();
} }

View File

@ -97,6 +97,7 @@ public:
UnitParticleSystemType *unitParticleSystemTypeForAffectedUnit; UnitParticleSystemType *unitParticleSystemTypeForAffectedUnit;
bool includeSelf; bool includeSelf;
string name;
bool isAffected(const Unit *source, const Unit *dest) const; bool isAffected(const Unit *source, const Unit *dest) const;
}; };
@ -131,18 +132,30 @@ protected:
RandomGen random; RandomGen random;
AttackBoost attackBoost; AttackBoost attackBoost;
static int nextAttackBoostId;
static int getNextAttackBoostId() { return ++nextAttackBoostId; }
const XmlNode * findAttackBoostDetails(string attackBoostName,
const XmlNode *attackBoostsNode,const XmlNode *attackBoostNode);
void loadAttackBoost(const XmlNode *attackBoostsNode,
const XmlNode *attackBoostNode, const FactionType *ft,
string parentLoader, const string & dir, string currentPath,
std::map<string,vector<pair<string,string> > > & loadedFileList, const TechTree *tt);
public: public:
UnitParticleSystemTypes unitParticleSystemTypes; UnitParticleSystemTypes unitParticleSystemTypes;
public: public:
//varios //varios
virtual ~SkillType(); virtual ~SkillType();
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
bool CanCycleNextRandomAnimation(const int *animationRandomCycleCount) const; bool CanCycleNextRandomAnimation(const int *animationRandomCycleCount) const;
static void resetNextAttackBoostId() { nextAttackBoostId=0; }
//get //get
const string &getName() const {return name;} const string &getName() const {return name;}
SkillClass getClass() const {return skillClass;} SkillClass getClass() const {return skillClass;}
@ -213,7 +226,7 @@ private:
public: public:
AttackSkillType(); AttackSkillType();
~AttackSkillType(); ~AttackSkillType();
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString() const;
@ -285,7 +298,7 @@ private:
public: public:
ProduceSkillType(); ProduceSkillType();
bool getAnimProgressBound() const {return animProgressBound;} bool getAnimProgressBound() const {return animProgressBound;}
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
@ -304,7 +317,7 @@ private:
public: public:
UpgradeSkillType(); UpgradeSkillType();
bool getAnimProgressBound() const {return animProgressBound;} bool getAnimProgressBound() const {return animProgressBound;}
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
@ -326,7 +339,7 @@ public:
BeBuiltSkillType(); BeBuiltSkillType();
bool getAnimProgressBound() const {return animProgressBound;} bool getAnimProgressBound() const {return animProgressBound;}
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString() const;
@ -344,7 +357,7 @@ public:
MorphSkillType(); MorphSkillType();
bool getAnimProgressBound() const {return animProgressBound;} bool getAnimProgressBound() const {return animProgressBound;}
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
@ -364,7 +377,7 @@ public:
DieSkillType(); DieSkillType();
bool getFade() const {return fade;} bool getFade() const {return fade;}
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString() const;

View File

@ -32,6 +32,18 @@ namespace Glest{ namespace Game{
// class TechTree // class TechTree
// ===================================================== // =====================================================
TechTree::TechTree() {
SkillType::resetNextAttackBoostId();
name="";
treePath="";
resourceTypes.clear();
factionTypes.clear();
armorTypes.clear();
attackTypes.clear();
}
Checksum TechTree::loadTech(const vector<string> pathList, const string &techName, Checksum TechTree::loadTech(const vector<string> pathList, const string &techName,
set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) { set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
name = ""; name = "";

View File

@ -53,6 +53,8 @@ public:
set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList); set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
void load(const string &dir, set<string> &factions, Checksum* checksum, void load(const string &dir, set<string> &factions, Checksum* checksum,
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList); Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
TechTree();
~TechTree(); ~TechTree();
Checksum * getChecksumValue() { return &checksumValue; } Checksum * getChecksumValue() { return &checksumValue; }

View File

@ -512,6 +512,12 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
} }
//skills //skills
const XmlNode *attackBoostsNode= NULL;
if(unitNode->hasChild("attack-boosts") == true) {
attackBoostsNode=unitNode->getChild("attack-boosts");
}
const XmlNode *skillsNode= unitNode->getChild("skills"); const XmlNode *skillsNode= unitNode->getChild("skills");
skillTypes.resize(skillsNode->getChildCount()); skillTypes.resize(skillsNode->getChildCount());
for(int i = 0; i < skillTypes.size(); ++i) { for(int i = 0; i < skillTypes.size(); ++i) {
@ -519,7 +525,8 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
const XmlNode *typeNode= sn->getChild("type"); const XmlNode *typeNode= sn->getChild("type");
string classId= typeNode->getAttribute("value")->getRestrictedValue(); string classId= typeNode->getAttribute("value")->getRestrictedValue();
SkillType *skillType= SkillTypeFactory::getInstance().newInstance(classId); SkillType *skillType= SkillTypeFactory::getInstance().newInstance(classId);
skillType->load(sn, dir, techTree, factionType, loadedFileList,sourceXMLFile);
skillType->load(sn, attackBoostsNode, dir, techTree, factionType, loadedFileList,sourceXMLFile);
skillTypes[i]= skillType; skillTypes[i]= skillType;
} }