- 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__); 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,21 +51,30 @@ 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);
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"; string tmppath= currentPath + factionName +".xml";
std::map<string,string> mapExtraTagReplacementValues; std::map<string,string> mapExtraTagReplacementValues;
// mapExtraTagReplacementValues["$COMMONDATAPATH"] = techTreePath + "/commondata/"; // mapExtraTagReplacementValues["$COMMONDATAPATH"] = techTreePath + "/commondata/";
//printf("current $COMMONDATAPATH = %s\n",mapExtraTagReplacementValues["$COMMONDATAPATH"].c_str()); //printf("current $COMMONDATAPATH = %s\n",mapExtraTagReplacementValues["$COMMONDATAPATH"].c_str());
XmlTree xmlTree;
xmlTree.load(tmppath, Properties::getTagReplacementValues(&mapExtraTagReplacementValues)); 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");
@ -89,16 +96,9 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
path=tmppath; path=tmppath;
} }
} }
else {
checksum->addFile(path); break;
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]="";
@ -106,6 +106,9 @@ void FactionType::load(const string &factionName, const TechTree *techTree, Chec
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/";