- bugfix for observer mode, the new techtree linking broke observer mode loading

This commit is contained in:
Mark Vejvoda 2012-03-14 15:16:02 +00:00
parent 8d5de12d42
commit c3cd759302
1 changed files with 44 additions and 41 deletions

View File

@ -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__);
bool realFactionPathFound=false;
string techTreePath = techTree->getPath();
string techTreeName=techTree->getName();
string currentPath;
string currentPath = "";
//open xml file
string path="";
@ -53,25 +51,34 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
const XmlNode *factionNode;
//printf("\n>>> factionname=%s\n",factionName.c_str());
while(!realFactionPathFound){
XmlTree xmlTree;
for(bool realFactionPathFound=false;realFactionPathFound == false;) {
currentPath = techTreePath + "factions/" + factionName;
endPathWithSlash(currentPath);
name= lastDir(currentPath);
// Add special Observer Faction
//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/";
// 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();
if(rootNode->getName()=="link")
{
if(rootNode->getName()=="link") {
const XmlNode *techTreeNode= rootNode->getChild("techtree");
const string linkedTechTreeName=techTreeNode->getAttribute("name")->getRestrictedValue();
// const XmlNode *factionLinkNode= rootNode->getChild("faction");
// string linkedFactionName=factionLinkNode->getAttribute("name")->getRestrictedValue();
// const XmlNode *factionLinkNode= rootNode->getChild("faction");
// string linkedFactionName=factionLinkNode->getAttribute("name")->getRestrictedValue();
string linkedTechTreePath=techTree->findPath(linkedTechTreeName);
techTreePath=linkedTechTreePath;
endPathWithSlash(techTreePath);
@ -89,16 +96,9 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
path=tmppath;
}
}
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;
else {
break;
}
}
char szBuf[1024]="";
@ -106,6 +106,9 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
Logger::getInstance().add(szBuf, true);
if(personalityType == fpt_Normal) {
checksum->addFile(path);
techtreeChecksum->addFile(path);
// a1) preload units
//string unitsPath= currentPath + "units/*.";
string unitsPath= currentPath + "units/";