mirror of
https://github.com/glest/glest-source.git
synced 2025-09-01 20:12:40 +02:00
Supports importing unit
This commit is contained in:
@@ -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 +
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -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");
|
||||
|
||||
|
@@ -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,
|
||||
|
Reference in New Issue
Block a user