Supports importing unit

This commit is contained in:
mathusummut
2018-11-12 00:14:55 +01:00
parent e8ebd45d90
commit e6d37f37fb
4 changed files with 13 additions and 3 deletions

View File

@@ -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 +

View File

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

View File

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

View File

@@ -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,