- bugfix for observer mode, the new techtree linking broke observer mode loading
This commit is contained in:
parent
8d5de12d42
commit
c3cd759302
|
@ -41,11 +41,9 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
||||||
|
|
||||||
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
bool realFactionPathFound=false;
|
|
||||||
|
|
||||||
string techTreePath = techTree->getPath();
|
string techTreePath = techTree->getPath();
|
||||||
string techTreeName=techTree->getName();
|
string techTreeName=techTree->getName();
|
||||||
string currentPath;
|
string currentPath = "";
|
||||||
|
|
||||||
//open xml file
|
//open xml file
|
||||||
string path="";
|
string path="";
|
||||||
|
@ -53,59 +51,64 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
|
||||||
const XmlNode *factionNode;
|
const XmlNode *factionNode;
|
||||||
|
|
||||||
//printf("\n>>> factionname=%s\n",factionName.c_str());
|
//printf("\n>>> factionname=%s\n",factionName.c_str());
|
||||||
while(!realFactionPathFound){
|
for(bool realFactionPathFound=false;realFactionPathFound == false;) {
|
||||||
XmlTree xmlTree;
|
|
||||||
currentPath = techTreePath + "factions/" + factionName;
|
currentPath = techTreePath + "factions/" + factionName;
|
||||||
endPathWithSlash(currentPath);
|
endPathWithSlash(currentPath);
|
||||||
string tmppath= currentPath + factionName +".xml";
|
|
||||||
std::map<string,string> mapExtraTagReplacementValues;
|
name= lastDir(currentPath);
|
||||||
// mapExtraTagReplacementValues["$COMMONDATAPATH"] = techTreePath + "/commondata/";
|
|
||||||
//printf("current $COMMONDATAPATH = %s\n",mapExtraTagReplacementValues["$COMMONDATAPATH"].c_str());
|
// Add special Observer Faction
|
||||||
xmlTree.load(tmppath, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
//Lang &lang= Lang::getInstance();
|
||||||
|
if(name == formatString(GameConstants::OBSERVER_SLOTNAME)) {
|
||||||
|
personalityType = fpt_Observer;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(personalityType == fpt_Normal) {
|
||||||
|
string tmppath= currentPath + factionName +".xml";
|
||||||
|
std::map<string,string> mapExtraTagReplacementValues;
|
||||||
|
// mapExtraTagReplacementValues["$COMMONDATAPATH"] = techTreePath + "/commondata/";
|
||||||
|
//printf("current $COMMONDATAPATH = %s\n",mapExtraTagReplacementValues["$COMMONDATAPATH"].c_str());
|
||||||
|
XmlTree xmlTree;
|
||||||
|
xmlTree.load(tmppath, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
||||||
|
|
||||||
|
|
||||||
const XmlNode *rootNode= xmlTree.getRootNode();
|
const XmlNode *rootNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
if(rootNode->getName()=="link")
|
if(rootNode->getName()=="link") {
|
||||||
{
|
const XmlNode *techTreeNode= rootNode->getChild("techtree");
|
||||||
const XmlNode *techTreeNode= rootNode->getChild("techtree");
|
const string linkedTechTreeName=techTreeNode->getAttribute("name")->getRestrictedValue();
|
||||||
const string linkedTechTreeName=techTreeNode->getAttribute("name")->getRestrictedValue();
|
// const XmlNode *factionLinkNode= rootNode->getChild("faction");
|
||||||
// const XmlNode *factionLinkNode= rootNode->getChild("faction");
|
// string linkedFactionName=factionLinkNode->getAttribute("name")->getRestrictedValue();
|
||||||
// string linkedFactionName=factionLinkNode->getAttribute("name")->getRestrictedValue();
|
string linkedTechTreePath=techTree->findPath(linkedTechTreeName);
|
||||||
string linkedTechTreePath=techTree->findPath(linkedTechTreeName);
|
techTreePath=linkedTechTreePath;
|
||||||
techTreePath=linkedTechTreePath;
|
endPathWithSlash(techTreePath);
|
||||||
endPathWithSlash(techTreePath);
|
techTreeName=linkedTechTreeName;
|
||||||
techTreeName=linkedTechTreeName;
|
}
|
||||||
}
|
else {
|
||||||
else {
|
// stop looking for new path, no more links ...
|
||||||
// stop looking for new path, no more links ...
|
//xmlTree.load(tmppath, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
||||||
//xmlTree.load(tmppath, Properties::getTagReplacementValues(&mapExtraTagReplacementValues));
|
|
||||||
|
|
||||||
loadedFileList[tmppath].push_back(make_pair(currentPath,currentPath));
|
loadedFileList[tmppath].push_back(make_pair(currentPath,currentPath));
|
||||||
|
|
||||||
realFactionPathFound=true;
|
realFactionPathFound=true;
|
||||||
//printf("techPath found! %s\n",tmppath.c_str());
|
//printf("techPath found! %s\n",tmppath.c_str());
|
||||||
|
|
||||||
path=tmppath;
|
path=tmppath;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
checksum->addFile(path);
|
|
||||||
techtreeChecksum->addFile(path);
|
|
||||||
|
|
||||||
name= lastDir(currentPath);
|
|
||||||
|
|
||||||
// Add special Observer Faction
|
|
||||||
//Lang &lang= Lang::getInstance();
|
|
||||||
if(name == formatString(GameConstants::OBSERVER_SLOTNAME)) {
|
|
||||||
personalityType = fpt_Observer;
|
|
||||||
}
|
|
||||||
|
|
||||||
char szBuf[1024]="";
|
char szBuf[1024]="";
|
||||||
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingFactionType","",true).c_str(),formatString(name).c_str());
|
sprintf(szBuf,Lang::getInstance().get("LogScreenGameLoadingFactionType","",true).c_str(),formatString(name).c_str());
|
||||||
Logger::getInstance().add(szBuf, true);
|
Logger::getInstance().add(szBuf, true);
|
||||||
|
|
||||||
if(personalityType == fpt_Normal) {
|
if(personalityType == fpt_Normal) {
|
||||||
|
checksum->addFile(path);
|
||||||
|
techtreeChecksum->addFile(path);
|
||||||
|
|
||||||
// a1) preload units
|
// a1) preload units
|
||||||
//string unitsPath= currentPath + "units/*.";
|
//string unitsPath= currentPath + "units/*.";
|
||||||
string unitsPath= currentPath + "units/";
|
string unitsPath= currentPath + "units/";
|
||||||
|
|
Loading…
Reference in New Issue