diff --git a/source/glest_game/types/faction_type.cpp b/source/glest_game/types/faction_type.cpp index bf0d38bac..9479412d5 100644 --- a/source/glest_game/types/faction_type.cpp +++ b/source/glest_game/types/faction_type.cpp @@ -212,7 +212,7 @@ namespace Game { string str = currentPath + "units/" + unitTypes[i].getName(); try { - unitTypes[i].loaddd(i, str, techTree, techTreePath, this, + unitTypes[i].loadUnit(i, str, techTree, techTreePath, this, checksum, techtreeChecksum, loadedFileList, validationMode); logger.setProgress(progressBaseValue + diff --git a/source/glest_game/types/tech_tree.cpp b/source/glest_game/types/tech_tree.cpp index 92196891c..8c2dad212 100644 --- a/source/glest_game/types/tech_tree.cpp +++ b/source/glest_game/types/tech_tree.cpp @@ -217,6 +217,7 @@ namespace Game { //printf(">>> test path=%s\n",path.c_str()); if (isdir(path.c_str()) == true) { + //printf(">>> test path=%s\n", path.c_str()); return path; //break; } diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index 87b36c34b..baa7e266d 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -195,7 +195,7 @@ namespace Game { name = lastDir(dir); } - void UnitType::loaddd(int id, const string & dir, + void UnitType::loadUnit(int id, const string & dir, const TechTree * techTree, const string & techTreePath, const FactionType * factionType, @@ -242,6 +242,15 @@ namespace Game { loadedFileList[path].push_back(make_pair(dir, dir)); const XmlNode *unitNode = xmlTree.getRootNode(); + if (unitNode->hasChild("link")) { + XmlNode* node = unitNode->getChild("link"); + + string newFactionPath = techTree->findPath(node->getAttribute("tech-tree")->getValue()) + "/factions/" + node->getAttribute("faction")->getValue() + "/units/" + name; + //printf("\nPath: %s\n", newFactionPath.c_str()); + endPathWithSlash(newFactionPath, false); + loadUnit(id, newFactionPath, techTree, techTreePath, factionType, checksum, techtreeChecksum, loadedFileList, validationMode); + return; + } const XmlNode *parametersNode = unitNode->getChild("parameters"); diff --git a/source/glest_game/types/unit_type.h b/source/glest_game/types/unit_type.h index 30adbdfa4..58422ac22 100644 --- a/source/glest_game/types/unit_type.h +++ b/source/glest_game/types/unit_type.h @@ -277,7 +277,7 @@ namespace Game { UnitType(); virtual ~UnitType(); void preLoad(const string & dir); - void loaddd(int id, const string & dir, const TechTree * techTree, + void loadUnit(int id, const string & dir, const TechTree * techTree, const string & techTreePath, const FactionType * factionType, Checksum * checksum, Checksum * techtreeChecksum,