- display which files contain the reference (the parents) to duplicate data in validation report

This commit is contained in:
Mark Vejvoda
2011-05-05 20:18:38 +00:00
parent 6492832c35
commit c258dc0822
15 changed files with 149 additions and 119 deletions

View File

@@ -1116,7 +1116,7 @@ void MainWindow::loadParticle(string path) {
std::map<string,vector<string> > loadedFileList; std::map<string,vector<string> > loadedFileList;
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType(); UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath, unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath,
renderer,loadedFileList); renderer,loadedFileList,"g3dviewer");
unitParticleSystemTypes.push_back(unitParticleSystemType); unitParticleSystemTypes.push_back(unitParticleSystemType);
for(std::vector<UnitParticleSystemType *>::const_iterator it= unitParticleSystemTypes.begin(); it != unitParticleSystemTypes.end(); ++it) { for(std::vector<UnitParticleSystemType *>::const_iterator it= unitParticleSystemTypes.begin(); it != unitParticleSystemTypes.end(); ++it) {
@@ -1213,7 +1213,8 @@ void MainWindow::loadProjectileParticle(string path) {
std::map<string,vector<string> > loadedFileList; std::map<string,vector<string> > loadedFileList;
ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile(); ParticleSystemTypeProjectile *projectileParticleSystemType= new ParticleSystemTypeProjectile();
projectileParticleSystemType->load(dir, projectileParticleSystemType->load(dir,
dir + folderDelimiter + particlePath,renderer, loadedFileList); dir + folderDelimiter + particlePath,renderer, loadedFileList,
"g3dviewer");
// std::cout << "Values loaded, about to read..." << std::endl; // std::cout << "Values loaded, about to read..." << std::endl;
@@ -1315,7 +1316,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
std::map<string,vector<string> > loadedFileList; std::map<string,vector<string> > loadedFileList;
ParticleSystemTypeSplash *splashParticleSystemType= new ParticleSystemTypeSplash(); ParticleSystemTypeSplash *splashParticleSystemType= new ParticleSystemTypeSplash();
splashParticleSystemType->load(dir, dir + folderDelimiter + particlePath,renderer, splashParticleSystemType->load(dir, dir + folderDelimiter + particlePath,renderer,
loadedFileList); // <---- only that must be splash... loadedFileList,"g3dviewer"); // <---- only that must be splash...
// std::cout << "Values loaded, about to read..." << std::endl; // std::cout << "Values loaded, about to read..." << std::endl;

View File

@@ -41,7 +41,8 @@ ParticleSystemType::ParticleSystemType() {
} }
void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &dir, void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &dir,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList) { RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
string parentLoader) {
//texture //texture
const XmlNode *textureNode= particleSystemNode->getChild("texture"); const XmlNode *textureNode= particleSystemNode->getChild("texture");
bool textureEnabled= textureNode->getAttribute("value")->getBoolValue(); bool textureEnabled= textureNode->getAttribute("value")->getBoolValue();
@@ -58,7 +59,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
texture->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath)); texture->load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(parentLoader);
} }
else { else {
texture= NULL; texture= NULL;
@@ -75,8 +76,8 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
string path= modelNode->getAttribute("path")->getRestrictedValue(currentPath); string path= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
model= renderer->newModel(rsGame); model= renderer->newModel(rsGame);
model->load(path, false, &loadedFileList, &currentPath); model->load(path, false, &loadedFileList, &parentLoader);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
} }
} }
else { else {
@@ -186,16 +187,17 @@ void ParticleSystemType::setValues(AttackParticleSystem *ats){
// =========================================================== // ===========================================================
void ParticleSystemTypeProjectile::load(const string &dir, const string &path, void ParticleSystemTypeProjectile::load(const string &dir, const string &path,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList) { RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
string parentLoader) {
try{ try{
XmlTree xmlTree; XmlTree xmlTree;
xmlTree.load(path); xmlTree.load(path);
loadedFileList[path].push_back(dir); loadedFileList[path].push_back(parentLoader);
const XmlNode *particleSystemNode= xmlTree.getRootNode(); const XmlNode *particleSystemNode= xmlTree.getRootNode();
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList); ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList,parentLoader);
//trajectory values //trajectory values
const XmlNode *tajectoryNode= particleSystemNode->getChild("trajectory"); const XmlNode *tajectoryNode= particleSystemNode->getChild("trajectory");
@@ -247,16 +249,17 @@ ProjectileParticleSystem *ParticleSystemTypeProjectile::create() {
// =========================================================== // ===========================================================
void ParticleSystemTypeSplash::load(const string &dir, const string &path, void ParticleSystemTypeSplash::load(const string &dir, const string &path,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList) { RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
string parentLoader) {
try{ try{
XmlTree xmlTree; XmlTree xmlTree;
xmlTree.load(path); xmlTree.load(path);
loadedFileList[path].push_back(dir); loadedFileList[path].push_back(parentLoader);
const XmlNode *particleSystemNode= xmlTree.getRootNode(); const XmlNode *particleSystemNode= xmlTree.getRootNode();
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList); ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList, parentLoader);
//emission rate fade //emission rate fade
const XmlNode *emissionRateFadeNode= particleSystemNode->getChild("emission-rate-fade"); const XmlNode *emissionRateFadeNode= particleSystemNode->getChild("emission-rate-fade");

View File

@@ -68,7 +68,8 @@ protected:
public: public:
ParticleSystemType(); ParticleSystemType();
void load(const XmlNode *particleSystemNode, const string &dir, void load(const XmlNode *particleSystemNode, const string &dir,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList); RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
void setValues(AttackParticleSystem *ats); void setValues(AttackParticleSystem *ats);
bool hasTexture() const { return(texture != NULL); } bool hasTexture() const { return(texture != NULL); }
bool hasModel() const { return(model != NULL); } bool hasModel() const { return(model != NULL); }
@@ -90,7 +91,8 @@ private:
public: public:
void load(const string &dir, const string &path, void load(const string &dir, const string &path,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList); RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
ProjectileParticleSystem *create(); ProjectileParticleSystem *create();
}; };
@@ -102,7 +104,8 @@ public:
class ParticleSystemTypeSplash: public ParticleSystemType { class ParticleSystemTypeSplash: public ParticleSystemType {
public: public:
void load(const string &dir, const string &path, void load(const string &dir, const string &path,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList); RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
SplashParticleSystem *create(); SplashParticleSystem *create();
private: private:

View File

@@ -30,8 +30,9 @@ namespace Glest{ namespace Game{
// ===================================================== // =====================================================
void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const string &dir, void UnitParticleSystemType::load(const XmlNode *particleSystemNode, const string &dir,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList) { RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList); string parentLoader) {
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList, parentLoader);
//radius //radius
const XmlNode *radiusNode= particleSystemNode->getChild("radius"); const XmlNode *radiusNode= particleSystemNode->getChild("radius");
radius= radiusNode->getAttribute("value")->getFloatValue(); radius= radiusNode->getAttribute("value")->getFloatValue();
@@ -136,16 +137,17 @@ const void UnitParticleSystemType::setValues(UnitParticleSystem *ups){
} }
void UnitParticleSystemType::load(const string &dir, const string &path, void UnitParticleSystemType::load(const string &dir, const string &path,
RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList) { RendererInterface *renderer, std::map<string,vector<string> > &loadedFileList,
string parentLoader) {
try{ try{
XmlTree xmlTree; XmlTree xmlTree;
xmlTree.load(path); xmlTree.load(path);
loadedFileList[path].push_back(dir); loadedFileList[path].push_back(parentLoader);
const XmlNode *particleSystemNode= xmlTree.getRootNode(); const XmlNode *particleSystemNode= xmlTree.getRootNode();
UnitParticleSystemType::load(particleSystemNode, dir, renderer, UnitParticleSystemType::load(particleSystemNode, dir, renderer,
loadedFileList); loadedFileList, parentLoader);
} }
catch(const exception &e){ catch(const exception &e){
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what()); SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,e.what());
@@ -153,5 +155,4 @@ void UnitParticleSystemType::load(const string &dir, const string &path,
} }
} }
}}//end mamespace }}//end mamespace

View File

@@ -57,9 +57,10 @@ protected:
public: public:
void load(const XmlNode *particleSystemNode, const string &dir, void load(const XmlNode *particleSystemNode, const string &dir,
RendererInterface *newTexture, std::map<string,vector<string> > &loadedFileList); RendererInterface *newTexture, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
void load(const string &dir, const string &path, RendererInterface *newTexture, void load(const string &dir, const string &path, RendererInterface *newTexture,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList,string parentLoader);
const void setValues (UnitParticleSystem *uts); const void setValues (UnitParticleSystem *uts);
bool hasTexture() const { return(texture != NULL); } bool hasTexture() const { return(texture != NULL); }
}; };

View File

@@ -1460,6 +1460,7 @@ void runTechValidationForPath(string techPath, string techName,
printf("\nWarning, duplicate files were detected - START:\n=====================\n"); printf("\nWarning, duplicate files were detected - START:\n=====================\n");
} }
map<string,int> parentList;
for(unsigned int idx = 0; idx < fileList.size(); ++idx) { for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
string duplicateFile = fileList[idx]; string duplicateFile = fileList[idx];
if(idx > 0) { if(idx > 0) {
@@ -1473,15 +1474,21 @@ void runTechValidationForPath(string techPath, string techName,
} }
printf("[%s]\n",duplicateFile.c_str()); printf("[%s]\n",duplicateFile.c_str());
// std::map<string,vector<string> >::iterator iterFind = loadedFileList.find(duplicateFile); std::map<string,vector<string> >::iterator iterFind = loadedFileList.find(duplicateFile);
// if(iterFind != loadedFileList.end()) { if(iterFind != loadedFileList.end()) {
// for(unsigned int jdx = 0; jdx < iterFind->second.size(); jdx++) { for(unsigned int jdx = 0; jdx < iterFind->second.size(); jdx++) {
// if(jdx == 0) { parentList[iterFind->second[jdx]]++;
// printf("\tParents:\n"); }
// } }
// printf("\t[%s]\n",iterFind->second[jdx].c_str()); }
// }
// } for(map<string,int>::iterator iterMap = parentList.begin();
iterMap != parentList.end(); iterMap++) {
if(iterMap == parentList.begin()) {
printf("\tParents:\n");
}
printf("\t[%s]\n",iterMap->first.c_str());
} }
} }
} }

View File

@@ -44,7 +44,8 @@ CommandClass CommandType::getClass() const{
void CommandType::load(int id, const XmlNode *n, const string &dir, void CommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList,
string parentLoader) {
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__);
this->id= id; this->id= id;
@@ -57,7 +58,7 @@ void CommandType::load(int id, const XmlNode *n, const string &dir,
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath)); image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(parentLoader);
//unit requirements //unit requirements
const XmlNode *unitRequirementsNode= n->getChild("unit-requirements"); const XmlNode *unitRequirementsNode= n->getChild("unit-requirements");
@@ -112,8 +113,8 @@ string StopCommandType::toString() const{
void StopCommandType::load(int id, const XmlNode *n, const string &dir, void StopCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList,string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
//stop //stop
string skillName= n->getChild("stop-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("stop-skill")->getAttribute("value")->getRestrictedValue();
@@ -137,8 +138,9 @@ void MoveCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameInde
void MoveCommandType::load(int id, const XmlNode *n, const string &dir, void MoveCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList,
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
//move //move
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
@@ -186,8 +188,9 @@ void AttackCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIn
void AttackCommandType::load(int id, const XmlNode *n, const string &dir, void AttackCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList,
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
//move //move
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
@@ -278,8 +281,8 @@ void AttackStoppedCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int
void AttackStoppedCommandType::load(int id, const XmlNode *n, const string &dir, void AttackStoppedCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList,string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
//stop //stop
string skillName= n->getChild("stop-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("stop-skill")->getAttribute("value")->getRestrictedValue();
@@ -365,8 +368,8 @@ void BuildCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameInd
void BuildCommandType::load(int id, const XmlNode *n, const string &dir, void BuildCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList, string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
//move //move
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
@@ -397,7 +400,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir,
StaticSound *sound= new StaticSound(); StaticSound *sound= new StaticSound();
sound->load(path); sound->load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
startSounds[i]= sound; startSounds[i]= sound;
} }
} }
@@ -415,7 +418,7 @@ void BuildCommandType::load(int id, const XmlNode *n, const string &dir,
StaticSound *sound= new StaticSound(); StaticSound *sound= new StaticSound();
sound->load(path); sound->load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
builtSounds[i]= sound; builtSounds[i]= sound;
} }
} }
@@ -460,8 +463,8 @@ void HarvestCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameI
void HarvestCommandType::load(int id, const XmlNode *n, const string &dir, void HarvestCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList, string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
//move //move
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
@@ -541,8 +544,8 @@ void RepairCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameIn
void RepairCommandType::load(int id, const XmlNode *n, const string &dir, void RepairCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList, string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
//move //move
string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("move-skill")->getAttribute("value")->getRestrictedValue();
@@ -614,8 +617,8 @@ void ProduceCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameI
void ProduceCommandType::load(int id, const XmlNode *n, const string &dir, void ProduceCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList, string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
//produce //produce
string skillName= n->getChild("produce-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("produce-skill")->getAttribute("value")->getRestrictedValue();
@@ -679,9 +682,9 @@ void UpgradeCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameI
void UpgradeCommandType::load(int id, const XmlNode *n, const string &dir, void UpgradeCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList, string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
//upgrade //upgrade
string skillName= n->getChild("upgrade-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("upgrade-skill")->getAttribute("value")->getRestrictedValue();
@@ -736,8 +739,8 @@ void MorphCommandType::update(UnitUpdater *unitUpdater, Unit *unit, int frameInd
void MorphCommandType::load(int id, const XmlNode *n, const string &dir, void MorphCommandType::load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList, string parentLoader) {
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList); CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
//morph skill //morph skill
string skillName= n->getChild("morph-skill")->getAttribute("value")->getRestrictedValue(); string skillName= n->getChild("morph-skill")->getAttribute("value")->getRestrictedValue();

View File

@@ -83,7 +83,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const= 0; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const= 0;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const= 0; virtual string getDesc(const TotalUpgrade *totalUpgrade) const= 0;
virtual string toString() const= 0; virtual string toString() const= 0;
virtual const ProducibleType *getProduced() const {return NULL;} virtual const ProducibleType *getProduced() const {return NULL;}
@@ -117,7 +117,8 @@ public:
StopCommandType(); StopCommandType();
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, const TechTree *tt, virtual void load(int id, const XmlNode *n, const string &dir, const TechTree *tt,
const FactionType *ft, const UnitType &ut, std::map<string,vector<string> > &loadedFileList); const FactionType *ft, const UnitType &ut, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
virtual Queueability isQueuable() const {return qNever;} virtual Queueability isQueuable() const {return qNever;}
@@ -140,7 +141,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
@@ -163,7 +164,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
@@ -187,7 +188,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
@@ -215,7 +216,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
@@ -248,7 +249,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
virtual Queueability isQueuable() const {return qOnRequest;} virtual Queueability isQueuable() const {return qOnRequest;}
@@ -282,7 +283,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
@@ -311,7 +312,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string getReqDesc() const; virtual string getReqDesc() const;
virtual string toString() const; virtual string toString() const;
@@ -339,7 +340,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
virtual string getReqDesc() const; virtual string getReqDesc() const;
@@ -367,7 +368,7 @@ public:
virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const; virtual void update(UnitUpdater *unitUpdater, Unit *unit, int frameIndex) const;
virtual void load(int id, const XmlNode *n, const string &dir, virtual void load(int id, const XmlNode *n, const string &dir,
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade) const; virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
virtual string toString() const; virtual string toString() const;
virtual string getReqDesc() const; virtual string getReqDesc() const;

View File

@@ -61,6 +61,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
path= currentPath + name + ".xml"; path= currentPath + name + ".xml";
string sourceXMLFile = path;
checksum->addFile(path); checksum->addFile(path);
techtreeChecksum->addFile(path); techtreeChecksum->addFile(path);
@@ -75,7 +76,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
const XmlNode *imageNode= resourceNode->getChild("image"); const XmlNode *imageNode= resourceNode->getChild("image");
image= renderer.newTexture2D(rsGame); image= renderer.newTexture2D(rsGame);
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath)); image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
//type //type
const XmlNode *typeNode= resourceNode->getChild("type"); const XmlNode *typeNode= resourceNode->getChild("type");
@@ -90,8 +91,8 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
string modelPath= modelNode->getAttribute("path")->getRestrictedValue(currentPath); string modelPath= modelNode->getAttribute("path")->getRestrictedValue(currentPath);
model= renderer.newModel(rsGame); model= renderer.newModel(rsGame);
model->load(modelPath, false, &loadedFileList, &currentPath); model->load(modelPath, false, &loadedFileList, &sourceXMLFile);
loadedFileList[modelPath].push_back(currentPath); loadedFileList[modelPath].push_back(sourceXMLFile);
if(modelNode->hasChild("particles")){ if(modelNode->hasChild("particles")){
const XmlNode *particleNode= modelNode->getChild("particles"); const XmlNode *particleNode= modelNode->getChild("particles");
@@ -103,8 +104,8 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType(); ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType();
objectParticleSystemType->load(dir, currentPath + particlePath, objectParticleSystemType->load(dir, currentPath + particlePath,
&Renderer::getInstance(), loadedFileList); &Renderer::getInstance(), loadedFileList, sourceXMLFile);
loadedFileList[currentPath + particlePath].push_back(currentPath); loadedFileList[currentPath + particlePath].push_back(sourceXMLFile);
particleTypes.push_back(objectParticleSystemType); particleTypes.push_back(objectParticleSystemType);
} }

View File

@@ -42,7 +42,8 @@ SkillType::~SkillType() {
} }
void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<string> > &loadedFileList) { const FactionType *ft, std::map<string,vector<string> > &loadedFileList,
string parentLoader) {
//name //name
name= sn->getChild("name")->getAttribute("value")->getRestrictedValue(); name= sn->getChild("name")->getAttribute("value")->getRestrictedValue();
@@ -67,8 +68,8 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
string path= sn->getChild("animation")->getAttribute("path")->getRestrictedValue(currentPath); string path= sn->getChild("animation")->getAttribute("path")->getRestrictedValue(currentPath);
animation= Renderer::getInstance().newModel(rsGame); animation= Renderer::getInstance().newModel(rsGame);
animation->load(path, false, &loadedFileList, &currentPath); animation->load(path, false, &loadedFileList, &parentLoader);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
//particles //particles
if(sn->hasChild("particles")) { if(sn->hasChild("particles")) {
@@ -80,8 +81,8 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
string path= particleFileNode->getAttribute("path")->getRestrictedValue(); string path= particleFileNode->getAttribute("path")->getRestrictedValue();
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType(); UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
unitParticleSystemType->load(dir, currentPath + path, &Renderer::getInstance(), unitParticleSystemType->load(dir, currentPath + path, &Renderer::getInstance(),
loadedFileList); loadedFileList,parentLoader);
loadedFileList[currentPath + path].push_back(currentPath); loadedFileList[currentPath + path].push_back(parentLoader);
unitParticleSystemTypes.push_back(unitParticleSystemType); unitParticleSystemTypes.push_back(unitParticleSystemType);
} }
} }
@@ -98,7 +99,7 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
StaticSound *sound= new StaticSound(); StaticSound *sound= new StaticSound();
sound->load(path); sound->load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
sounds[i]= sound; sounds[i]= sound;
} }
} }
@@ -192,8 +193,9 @@ AttackSkillType::~AttackSkillType() {
} }
void AttackSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void AttackSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<string> > &loadedFileList) { const FactionType *ft, std::map<string,vector<string> > &loadedFileList,
SkillType::load(sn, dir, tt, ft, loadedFileList); string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
@@ -249,7 +251,7 @@ void AttackSkillType::load(const XmlNode *sn, const string &dir, const TechTree
string path= particleNode->getAttribute("path")->getRestrictedValue(); string path= particleNode->getAttribute("path")->getRestrictedValue();
projectileParticleSystemType= new ParticleSystemTypeProjectile(); projectileParticleSystemType= new ParticleSystemTypeProjectile();
projectileParticleSystemType->load(dir, currentPath + path, projectileParticleSystemType->load(dir, currentPath + path,
&Renderer::getInstance(), loadedFileList); &Renderer::getInstance(), loadedFileList, parentLoader);
} }
//proj sounds //proj sounds
@@ -263,7 +265,7 @@ void AttackSkillType::load(const XmlNode *sn, const string &dir, const TechTree
StaticSound *sound= new StaticSound(); StaticSound *sound= new StaticSound();
sound->load(path); sound->load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
projSounds[i]= sound; projSounds[i]= sound;
} }
} }
@@ -283,7 +285,7 @@ void AttackSkillType::load(const XmlNode *sn, const string &dir, const TechTree
string path= particleNode->getAttribute("path")->getRestrictedValue(); string path= particleNode->getAttribute("path")->getRestrictedValue();
splashParticleSystemType= new ParticleSystemTypeSplash(); splashParticleSystemType= new ParticleSystemTypeSplash();
splashParticleSystemType->load(dir, currentPath + path, splashParticleSystemType->load(dir, currentPath + path,
&Renderer::getInstance(),loadedFileList); &Renderer::getInstance(),loadedFileList, parentLoader);
} }
} }
} }
@@ -406,8 +408,9 @@ DieSkillType::DieSkillType(){
} }
void DieSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt, void DieSkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<string> > &loadedFileList) { const FactionType *ft, std::map<string,vector<string> > &loadedFileList,
SkillType::load(sn, dir, tt, ft, loadedFileList); string parentLoader) {
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
fade= sn->getChild("fade")->getAttribute("value")->getBoolValue(); fade= sn->getChild("fade")->getAttribute("value")->getBoolValue();
} }

View File

@@ -92,7 +92,8 @@ public:
//varios //varios
virtual ~SkillType(); virtual ~SkillType();
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<string> > &loadedFileList); const FactionType *ft, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
//get //get
const string &getName() const {return name;} const string &getName() const {return name;}
@@ -162,7 +163,8 @@ public:
AttackSkillType(); AttackSkillType();
~AttackSkillType(); ~AttackSkillType();
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<string> > &loadedFileList); const FactionType *ft, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
virtual string toString() const; virtual string toString() const;
//get //get
@@ -282,7 +284,8 @@ public:
bool getFade() const {return fade;} bool getFade() const {return fade;}
virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt, virtual void load(const XmlNode *sn, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<string> > &loadedFileList); const FactionType *ft, std::map<string,vector<string> > &loadedFileList,
string parentLoader);
virtual string toString() const; virtual string toString() const;
}; };

View File

@@ -126,6 +126,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
string path = currentPath + name + ".xml"; string path = currentPath + name + ".xml";
string sourceXMLFile = path;
this->id= id; this->id= id;
@@ -294,8 +295,8 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
Texture2D *newTexture = NULL; Texture2D *newTexture = NULL;
unitParticleSystemType->load(dir, currentPath + path, unitParticleSystemType->load(dir, currentPath + path,
&Renderer::getInstance(),loadedFileList); &Renderer::getInstance(),loadedFileList, sourceXMLFile);
loadedFileList[currentPath + path].push_back(dir); loadedFileList[currentPath + path].push_back(sourceXMLFile);
//if(unitParticleSystemType->hasTexture() == false) { //if(unitParticleSystemType->hasTexture() == false) {
//Renderer::getInstance().endLastTexture(rsGame,true); //Renderer::getInstance().endLastTexture(rsGame,true);
@@ -399,13 +400,13 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
const XmlNode *imageNode= parametersNode->getChild("image"); const XmlNode *imageNode= parametersNode->getChild("image");
image= Renderer::getInstance().newTexture2D(rsGame); image= Renderer::getInstance().newTexture2D(rsGame);
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath)); image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath));
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
//image cancel //image cancel
const XmlNode *imageCancelNode= parametersNode->getChild("image-cancel"); const XmlNode *imageCancelNode= parametersNode->getChild("image-cancel");
cancelImage= Renderer::getInstance().newTexture2D(rsGame); cancelImage= Renderer::getInstance().newTexture2D(rsGame);
cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath)); cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath));
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
//meeting point //meeting point
const XmlNode *meetingPointNode= parametersNode->getChild("meeting-point"); const XmlNode *meetingPointNode= parametersNode->getChild("meeting-point");
@@ -413,33 +414,33 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
if(meetingPoint) { if(meetingPoint) {
meetingPointImage= Renderer::getInstance().newTexture2D(rsGame); meetingPointImage= Renderer::getInstance().newTexture2D(rsGame);
meetingPointImage->load(meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath)); meetingPointImage->load(meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath));
loadedFileList[meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
} }
//selection sounds //selection sounds
const XmlNode *selectionSoundNode= parametersNode->getChild("selection-sounds"); const XmlNode *selectionSoundNode= parametersNode->getChild("selection-sounds");
if(selectionSoundNode->getAttribute("enabled")->getBoolValue()){ if(selectionSoundNode->getAttribute("enabled")->getBoolValue()){
selectionSounds.resize(selectionSoundNode->getChildCount()); selectionSounds.resize(selectionSoundNode->getChildCount());
for(int i=0; i<selectionSounds.getSounds().size(); ++i){ for(int i = 0; i < selectionSounds.getSounds().size(); ++i) {
const XmlNode *soundNode= selectionSoundNode->getChild("sound", i); const XmlNode *soundNode= selectionSoundNode->getChild("sound", i);
string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath); string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath);
StaticSound *sound= new StaticSound(); StaticSound *sound= new StaticSound();
sound->load(path); sound->load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(sourceXMLFile);
selectionSounds[i]= sound; selectionSounds[i]= sound;
} }
} }
//command sounds //command sounds
const XmlNode *commandSoundNode= parametersNode->getChild("command-sounds"); const XmlNode *commandSoundNode= parametersNode->getChild("command-sounds");
if(commandSoundNode->getAttribute("enabled")->getBoolValue()){ if(commandSoundNode->getAttribute("enabled")->getBoolValue()) {
commandSounds.resize(commandSoundNode->getChildCount()); commandSounds.resize(commandSoundNode->getChildCount());
for(int i=0; i<commandSoundNode->getChildCount(); ++i){ for(int i = 0; i < commandSoundNode->getChildCount(); ++i) {
const XmlNode *soundNode= commandSoundNode->getChild("sound", i); const XmlNode *soundNode= commandSoundNode->getChild("sound", i);
string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath); string path= soundNode->getAttribute("path")->getRestrictedValue(currentPath);
StaticSound *sound= new StaticSound(); StaticSound *sound= new StaticSound();
sound->load(path); sound->load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(sourceXMLFile);
commandSounds[i]= sound; commandSounds[i]= sound;
} }
} }
@@ -452,7 +453,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
const XmlNode *typeNode= sn->getChild("type"); const XmlNode *typeNode= sn->getChild("type");
string classId= typeNode->getAttribute("value")->getRestrictedValue(); string classId= typeNode->getAttribute("value")->getRestrictedValue();
SkillType *skillType= SkillTypeFactory::getInstance().newInstance(classId); SkillType *skillType= SkillTypeFactory::getInstance().newInstance(classId);
skillType->load(sn, dir, techTree, factionType, loadedFileList); skillType->load(sn, dir, techTree, factionType, loadedFileList,sourceXMLFile);
skillTypes[i]= skillType; skillTypes[i]= skillType;
} }
@@ -465,7 +466,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
string classId= typeNode->getAttribute("value")->getRestrictedValue(); string classId= typeNode->getAttribute("value")->getRestrictedValue();
CommandType *commandType= CommandTypeFactory::getInstance().newInstance(classId); CommandType *commandType= CommandTypeFactory::getInstance().newInstance(classId);
commandType->load(i, commandNode, dir, techTree, factionType, *this, commandType->load(i, commandNode, dir, techTree, factionType, *this,
loadedFileList); loadedFileList,sourceXMLFile);
commandTypes[i]= commandType; commandTypes[i]= commandType;
} }

View File

@@ -57,6 +57,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
string path = currentPath + name + ".xml"; string path = currentPath + name + ".xml";
string sourceXMLFile = path;
try{ try{
checksum->addFile(path); checksum->addFile(path);
@@ -71,7 +72,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
const XmlNode *imageNode= upgradeNode->getChild("image"); const XmlNode *imageNode= upgradeNode->getChild("image");
image= Renderer::getInstance().newTexture2D(rsGame); image= Renderer::getInstance().newTexture2D(rsGame);
image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)); image->load(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true));
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(currentPath); loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(sourceXMLFile);
//if(fileExists(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) { //if(fileExists(imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
// printf("\n***ERROR MISSING FILE [%s]\n",imageNode->getAttribute("path")->getRestrictedValue(currentPath,true).c_str()); // printf("\n***ERROR MISSING FILE [%s]\n",imageNode->getAttribute("path")->getRestrictedValue(currentPath,true).c_str());
@@ -81,7 +82,7 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
const XmlNode *imageCancelNode= upgradeNode->getChild("image-cancel"); const XmlNode *imageCancelNode= upgradeNode->getChild("image-cancel");
cancelImage= Renderer::getInstance().newTexture2D(rsGame); cancelImage= Renderer::getInstance().newTexture2D(rsGame);
cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)); cancelImage->load(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true));
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(currentPath); loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(sourceXMLFile);
//if(fileExists(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) { //if(fileExists(imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)) == false) {
// printf("\n***ERROR MISSING FILE [%s]\n",imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true).c_str()); // printf("\n***ERROR MISSING FILE [%s]\n",imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true).c_str());

View File

@@ -32,8 +32,8 @@ namespace Glest{ namespace Game{
// ===================================================== // =====================================================
void AmbientSounds::load(const string &dir, const XmlNode *xmlNode, void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
std::map<string,vector<string> > &loadedFileList) { std::map<string,vector<string> > &loadedFileList, string parentLoader) {
string path; string path="";
//day //day
const XmlNode *dayNode= xmlNode->getChild("day-sound"); const XmlNode *dayNode= xmlNode->getChild("day-sound");
@@ -44,7 +44,7 @@ void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
path= dayNode->getAttribute("path")->getRestrictedValue(currentPath); path= dayNode->getAttribute("path")->getRestrictedValue(currentPath);
day.open(path); day.open(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
alwaysPlayDay= dayNode->getAttribute("play-always")->getBoolValue(); alwaysPlayDay= dayNode->getAttribute("play-always")->getBoolValue();
} }
@@ -58,7 +58,7 @@ void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
path= nightNode->getAttribute("path")->getRestrictedValue(currentPath); path= nightNode->getAttribute("path")->getRestrictedValue(currentPath);
night.open(path); night.open(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
alwaysPlayNight= nightNode->getAttribute("play-always")->getBoolValue(); alwaysPlayNight= nightNode->getAttribute("play-always")->getBoolValue();
} }
@@ -72,7 +72,7 @@ void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
path= rainNode->getAttribute("path")->getRestrictedValue(currentPath); path= rainNode->getAttribute("path")->getRestrictedValue(currentPath);
rain.open(path); rain.open(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
} }
//snow //snow
@@ -84,7 +84,7 @@ void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
path= snowNode->getAttribute("path")->getRestrictedValue(currentPath); path= snowNode->getAttribute("path")->getRestrictedValue(currentPath);
snow.open(path); snow.open(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
} }
//dayStart //dayStart
@@ -96,7 +96,7 @@ void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
path= dayStartNode->getAttribute("path")->getRestrictedValue(currentPath); path= dayStartNode->getAttribute("path")->getRestrictedValue(currentPath);
dayStart.load(path); dayStart.load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
} }
//nightStart //nightStart
@@ -108,7 +108,7 @@ void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
path= nightStartNode->getAttribute("path")->getRestrictedValue(currentPath); path= nightStartNode->getAttribute("path")->getRestrictedValue(currentPath);
nightStart.load(path); nightStart.load(path);
loadedFileList[path].push_back(currentPath); loadedFileList[path].push_back(parentLoader);
} }
} }
@@ -144,6 +144,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
string currentPath = dir; string currentPath = dir;
endPathWithSlash(currentPath); endPathWithSlash(currentPath);
string path= currentPath + name + ".xml"; string path= currentPath + name + ".xml";
string sourceXMLFile = path;
checksum->addFile(path); checksum->addFile(path);
tilesetChecksum->addFile(path); tilesetChecksum->addFile(path);
@@ -186,7 +187,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
const XmlNode *textureNode= surfaceNode->getChild("texture", j); const XmlNode *textureNode= surfaceNode->getChild("texture", j);
surfPixmaps[i][j].init(3); surfPixmaps[i][j].init(3);
surfPixmaps[i][j].load(textureNode->getAttribute("path")->getRestrictedValue(currentPath)); surfPixmaps[i][j].load(textureNode->getAttribute("path")->getRestrictedValue(currentPath));
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue(); surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue();
} }
@@ -213,8 +214,8 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
for(int j=0; j<childCount; ++j) { for(int j=0; j<childCount; ++j) {
const XmlNode *modelNode= objectNode->getChild("model", j); const XmlNode *modelNode= objectNode->getChild("model", j);
const XmlAttribute *pathAttribute= modelNode->getAttribute("path"); const XmlAttribute *pathAttribute= modelNode->getAttribute("path");
objectTypes[i].loadModel(pathAttribute->getRestrictedValue(currentPath),&loadedFileList, currentPath); objectTypes[i].loadModel(pathAttribute->getRestrictedValue(currentPath),&loadedFileList, sourceXMLFile);
loadedFileList[pathAttribute->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[pathAttribute->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
if(modelNode->hasChild("particles")){ if(modelNode->hasChild("particles")){
const XmlNode *particleNode= modelNode->getChild("particles"); const XmlNode *particleNode= modelNode->getChild("particles");
@@ -225,8 +226,8 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
string path= particleFileNode->getAttribute("path")->getRestrictedValue(); string path= particleFileNode->getAttribute("path")->getRestrictedValue();
ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType(); ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType();
objectParticleSystemType->load(dir, currentPath + path, objectParticleSystemType->load(dir, currentPath + path,
&Renderer::getInstance(), loadedFileList); &Renderer::getInstance(), loadedFileList, sourceXMLFile);
loadedFileList[currentPath + path].push_back(currentPath); loadedFileList[currentPath + path].push_back(sourceXMLFile);
objectTypes[i].addParticleSystem((objectParticleSystemType)); objectTypes[i].addParticleSystem((objectParticleSystemType));
} }
@@ -243,7 +244,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
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__);
//ambient sounds //ambient sounds
ambientSounds.load(dir, tilesetNode->getChild("ambient-sounds"), loadedFileList); ambientSounds.load(dir, tilesetNode->getChild("ambient-sounds"), loadedFileList, sourceXMLFile);
//parameters //parameters
const XmlNode *parametersNode= tilesetNode->getChild("parameters"); const XmlNode *parametersNode= tilesetNode->getChild("parameters");
@@ -262,7 +263,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
for(int i=0; i<waterFrameCount; ++i){ for(int i=0; i<waterFrameCount; ++i){
const XmlNode *waterFrameNode= waterNode->getChild("texture", i); const XmlNode *waterFrameNode= waterNode->getChild("texture", i);
waterTex->getPixmap()->loadSlice(waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath), i); waterTex->getPixmap()->loadSlice(waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath), i);
loadedFileList[waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath); loadedFileList[waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
} }
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__);

View File

@@ -89,7 +89,7 @@ public:
StaticSound *getNightStart() {return &nightStart;} StaticSound *getNightStart() {return &nightStart;}
void load(const string &dir, const XmlNode *xmlNode, void load(const string &dir, const XmlNode *xmlNode,
std::map<string,vector<string> > &loadedFileList); std::map<string,vector<string> > &loadedFileList,string parentLoader);
}; };
// ===================================================== // =====================================================