mirror of
https://github.com/glest/glest-source.git
synced 2025-09-02 12:32:34 +02:00
Supports importing unit
This commit is contained in:
@@ -212,7 +212,7 @@ namespace Game {
|
|||||||
string str = currentPath + "units/" + unitTypes[i].getName();
|
string str = currentPath + "units/" + unitTypes[i].getName();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
unitTypes[i].loaddd(i, str, techTree, techTreePath, this,
|
unitTypes[i].loadUnit(i, str, techTree, techTreePath, this,
|
||||||
checksum, techtreeChecksum, loadedFileList,
|
checksum, techtreeChecksum, loadedFileList,
|
||||||
validationMode);
|
validationMode);
|
||||||
logger.setProgress(progressBaseValue +
|
logger.setProgress(progressBaseValue +
|
||||||
|
@@ -217,6 +217,7 @@ namespace Game {
|
|||||||
|
|
||||||
//printf(">>> test path=%s\n",path.c_str());
|
//printf(">>> test path=%s\n",path.c_str());
|
||||||
if (isdir(path.c_str()) == true) {
|
if (isdir(path.c_str()) == true) {
|
||||||
|
//printf(">>> test path=%s\n", path.c_str());
|
||||||
return path;
|
return path;
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
|
@@ -195,7 +195,7 @@ namespace Game {
|
|||||||
name = lastDir(dir);
|
name = lastDir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnitType::loaddd(int id, const string & dir,
|
void UnitType::loadUnit(int id, const string & dir,
|
||||||
const TechTree * techTree,
|
const TechTree * techTree,
|
||||||
const string & techTreePath,
|
const string & techTreePath,
|
||||||
const FactionType * factionType,
|
const FactionType * factionType,
|
||||||
@@ -242,6 +242,15 @@ namespace Game {
|
|||||||
loadedFileList[path].push_back(make_pair(dir, dir));
|
loadedFileList[path].push_back(make_pair(dir, dir));
|
||||||
|
|
||||||
const XmlNode *unitNode = xmlTree.getRootNode();
|
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");
|
const XmlNode *parametersNode = unitNode->getChild("parameters");
|
||||||
|
|
||||||
|
@@ -277,7 +277,7 @@ namespace Game {
|
|||||||
UnitType();
|
UnitType();
|
||||||
virtual ~UnitType();
|
virtual ~UnitType();
|
||||||
void preLoad(const string & dir);
|
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 string & techTreePath,
|
||||||
const FactionType * factionType, Checksum * checksum,
|
const FactionType * factionType, Checksum * checksum,
|
||||||
Checksum * techtreeChecksum,
|
Checksum * techtreeChecksum,
|
||||||
|
Reference in New Issue
Block a user