mirror of
https://github.com/glest/glest-source.git
synced 2025-09-26 23:49:03 +02:00
- added code to merge duplicate sounds used in a techtree
This commit is contained in:
@@ -1113,7 +1113,7 @@ void MainWindow::loadParticle(string path) {
|
|||||||
|
|
||||||
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
// std::cout << "About to load [" << particlePath << "] from [" << dir << "] unit [" << unitXML << "]" << std::endl;
|
||||||
|
|
||||||
std::map<string,vector<string> > loadedFileList;
|
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||||
UnitParticleSystemType *unitParticleSystemType = new UnitParticleSystemType();
|
UnitParticleSystemType *unitParticleSystemType = new UnitParticleSystemType();
|
||||||
unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath,
|
unitParticleSystemType->load(dir, dir + folderDelimiter + particlePath,
|
||||||
renderer,loadedFileList,"g3dviewer");
|
renderer,loadedFileList,"g3dviewer");
|
||||||
@@ -1210,7 +1210,7 @@ void MainWindow::loadProjectileParticle(string path) {
|
|||||||
|
|
||||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||||
|
|
||||||
std::map<string,vector<string> > loadedFileList;
|
std::map<string,vector<pair<string, 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,
|
||||||
@@ -1313,7 +1313,7 @@ void MainWindow::loadSplashParticle(string path) { // uses ParticleSystemTypeSp
|
|||||||
|
|
||||||
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
// std::cout << "Loaded successfully, loading values..." << std::endl;
|
||||||
|
|
||||||
std::map<string,vector<string> > loadedFileList;
|
std::map<string,vector<pair<string, 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,"g3dviewer"); // <---- only that must be splash...
|
loadedFileList,"g3dviewer"); // <---- only that must be splash...
|
||||||
|
@@ -458,7 +458,7 @@ void Game::load() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Game::load(LoadGameItem loadTypes) {
|
void Game::load(LoadGameItem loadTypes) {
|
||||||
std::map<string,vector<string> > loadedFileList;
|
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||||
originalDisplayMsgCallback = NetworkInterface::getDisplayMessageFunction();
|
originalDisplayMsgCallback = NetworkInterface::getDisplayMessageFunction();
|
||||||
NetworkInterface::setDisplayMessageFunction(ErrorDisplayMessage);
|
NetworkInterface::setDisplayMessageFunction(ErrorDisplayMessage);
|
||||||
|
|
||||||
|
@@ -41,7 +41,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
//texture
|
//texture
|
||||||
const XmlNode *textureNode= particleSystemNode->getChild("texture");
|
const XmlNode *textureNode= particleSystemNode->getChild("texture");
|
||||||
@@ -59,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(parentLoader);
|
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(parentLoader,textureNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
texture= NULL;
|
texture= NULL;
|
||||||
@@ -77,7 +77,7 @@ void ParticleSystemType::load(const XmlNode *particleSystemNode, const string &d
|
|||||||
model= renderer->newModel(rsGame);
|
model= renderer->newModel(rsGame);
|
||||||
|
|
||||||
model->load(path, false, &loadedFileList, &parentLoader);
|
model->load(path, false, &loadedFileList, &parentLoader);
|
||||||
loadedFileList[path].push_back(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,modelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -187,13 +187,13 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,parentLoader));
|
||||||
|
|
||||||
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
@@ -249,13 +249,13 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,parentLoader));
|
||||||
|
|
||||||
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
|
@@ -68,7 +68,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
string parentLoader);
|
||||||
void setValues(AttackParticleSystem *ats);
|
void setValues(AttackParticleSystem *ats);
|
||||||
bool hasTexture() const { return(texture != NULL); }
|
bool hasTexture() const { return(texture != NULL); }
|
||||||
@@ -91,7 +91,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
string parentLoader);
|
||||||
ProjectileParticleSystem *create();
|
ProjectileParticleSystem *create();
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
string parentLoader);
|
||||||
SplashParticleSystem *create();
|
SplashParticleSystem *create();
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList, parentLoader);
|
ParticleSystemType::load(particleSystemNode, dir, renderer, loadedFileList, parentLoader);
|
||||||
//radius
|
//radius
|
||||||
@@ -137,13 +137,13 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,parentLoader));
|
||||||
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
const XmlNode *particleSystemNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
UnitParticleSystemType::load(particleSystemNode, dir, renderer,
|
UnitParticleSystemType::load(particleSystemNode, dir, renderer,
|
||||||
|
@@ -57,10 +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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
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,string parentLoader);
|
std::map<string,vector<pair<string, 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); }
|
||||||
};
|
};
|
||||||
|
@@ -969,15 +969,17 @@ void printParameterHelp(const char *argv0, bool foundInvalidArgs) {
|
|||||||
printf("\n%s\t\t\tdisplays your SDL version information.",GAME_ARGS[GAME_ARG_SDL_INFO]);
|
printf("\n%s\t\t\tdisplays your SDL version information.",GAME_ARGS[GAME_ARG_SDL_INFO]);
|
||||||
printf("\n%s\t\t\tdisplays your LUA version information.",GAME_ARGS[GAME_ARG_LUA_INFO]);
|
printf("\n%s\t\t\tdisplays your LUA version information.",GAME_ARGS[GAME_ARG_LUA_INFO]);
|
||||||
printf("\n%s\t\t\tdisplays your CURL version information.",GAME_ARGS[GAME_ARG_CURL_INFO]);
|
printf("\n%s\t\t\tdisplays your CURL version information.",GAME_ARGS[GAME_ARG_CURL_INFO]);
|
||||||
printf("\n%s=x=purgeunused\t\tdisplays a report detailing any known problems related",GAME_ARGS[GAME_ARG_VALIDATE_TECHTREES]);
|
printf("\n%s=x=purgeunused=purgeduplicates\t\tdisplays a report detailing any known problems related",GAME_ARGS[GAME_ARG_VALIDATE_TECHTREES]);
|
||||||
printf("\n \t\tto your selected techtrees game data.");
|
printf("\n \t\tto your selected techtrees game data.");
|
||||||
printf("\n \t\tWhere x is a comma-delimited list of techtrees to validate.");
|
printf("\n \t\tWhere x is a comma-delimited list of techtrees to validate.");
|
||||||
printf("\n \t\tWhere purgeunused is an optional parameter telling the validation to delete extra files in the techtree that are not used.");
|
printf("\n \t\tWhere purgeunused is an optional parameter telling the validation to delete extra files in the techtree that are not used.");
|
||||||
|
printf("\n \t\tWhere purgeduplicates is an optional parameter telling the validation to merge duplicate files in the techtree.");
|
||||||
printf("\n \t\texample: %s %s=megapack,vbros_pack_5",argv0,GAME_ARGS[GAME_ARG_VALIDATE_TECHTREES]);
|
printf("\n \t\texample: %s %s=megapack,vbros_pack_5",argv0,GAME_ARGS[GAME_ARG_VALIDATE_TECHTREES]);
|
||||||
printf("\n%s=x=purgeunused\t\tdisplays a report detailing any known problems related",GAME_ARGS[GAME_ARG_VALIDATE_FACTIONS]);
|
printf("\n%s=x=purgeunused=purgeduplicates\t\tdisplays a report detailing any known problems related",GAME_ARGS[GAME_ARG_VALIDATE_FACTIONS]);
|
||||||
printf("\n \t\tto your selected factions game data.");
|
printf("\n \t\tto your selected factions game data.");
|
||||||
printf("\n \t\tWhere x is a comma-delimited list of factions to validate.");
|
printf("\n \t\tWhere x is a comma-delimited list of factions to validate.");
|
||||||
printf("\n \t\tWhere purgeunused is an optional parameter telling the validation to delete extra files in the faction that are not used.");
|
printf("\n \t\tWhere purgeunused is an optional parameter telling the validation to delete extra files in the faction that are not used.");
|
||||||
|
printf("\n \t\tWhere purgeduplicates is an optional parameter telling the validation to merge duplicate files in the faction.");
|
||||||
printf("\n \t\t*NOTE: leaving the list empty is the same as running");
|
printf("\n \t\t*NOTE: leaving the list empty is the same as running");
|
||||||
printf("\n \t\t%s",GAME_ARGS[GAME_ARG_VALIDATE_TECHTREES]);
|
printf("\n \t\t%s",GAME_ARGS[GAME_ARG_VALIDATE_TECHTREES]);
|
||||||
printf("\n \t\texample: %s %s=tech,egypt",argv0,GAME_ARGS[GAME_ARG_VALIDATE_FACTIONS]);
|
printf("\n \t\texample: %s %s=tech,egypt",argv0,GAME_ARGS[GAME_ARG_VALIDATE_FACTIONS]);
|
||||||
@@ -1269,7 +1271,7 @@ void setupLogging(Config &config, bool haveSpecialOutputCommandLineOption) {
|
|||||||
|
|
||||||
void runTechValidationForPath(string techPath, string techName,
|
void runTechValidationForPath(string techPath, string techName,
|
||||||
const std::vector<string> filteredFactionList, World &world,
|
const std::vector<string> filteredFactionList, World &world,
|
||||||
bool purgeUnusedFiles,double &purgedMegaBytes) {
|
bool purgeUnusedFiles,bool purgeDuplicateFiles, double &purgedMegaBytes) {
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
vector<string> factionsList;
|
vector<string> factionsList;
|
||||||
findDirs(techPath + techName + "/factions/", factionsList, false, false);
|
findDirs(techPath + techName + "/factions/", factionsList, false, false);
|
||||||
@@ -1296,7 +1298,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
if(factions.size() > 0) {
|
if(factions.size() > 0) {
|
||||||
bool techtree_errors = false;
|
bool techtree_errors = false;
|
||||||
|
|
||||||
std::map<string,vector<string> > loadedFileList;
|
std::map<string,vector<pair<string, string> > > loadedFileList;
|
||||||
//vector<string> pathList = config.getPathListForType(ptTechs,"");
|
//vector<string> pathList = config.getPathListForType(ptTechs,"");
|
||||||
vector<string> pathList;
|
vector<string> pathList;
|
||||||
pathList.push_back(techPath);
|
pathList.push_back(techPath);
|
||||||
@@ -1304,16 +1306,24 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
|
|
||||||
// Fixup paths with ..
|
// Fixup paths with ..
|
||||||
{
|
{
|
||||||
std::map<string,vector<string> > newLoadedFileList;
|
std::map<string,vector<pair<string, string> > > newLoadedFileList;
|
||||||
for( std::map<string,vector<string> >::iterator iterMap = loadedFileList.begin();
|
for( std::map<string,vector<pair<string, string> > >::iterator iterMap = loadedFileList.begin();
|
||||||
iterMap != loadedFileList.end(); ++iterMap) {
|
iterMap != loadedFileList.end(); ++iterMap) {
|
||||||
string loadedFile = iterMap->first;
|
string loadedFile = iterMap->first;
|
||||||
|
|
||||||
replaceAll(loadedFile,"//","/");
|
replaceAll(loadedFile,"//","/");
|
||||||
replaceAll(loadedFile,"\\\\","\\");
|
replaceAll(loadedFile,"\\\\","\\");
|
||||||
updatePathClimbingParts(loadedFile);
|
updatePathClimbingParts(loadedFile);
|
||||||
|
|
||||||
|
if(newLoadedFileList.find(loadedFile) != newLoadedFileList.end()) {
|
||||||
|
for(unsigned int xx1 = 0; xx1 < iterMap->second.size(); ++xx1) {
|
||||||
|
newLoadedFileList[loadedFile].push_back(iterMap->second[xx1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
newLoadedFileList[loadedFile] = iterMap->second;
|
newLoadedFileList[loadedFile] = iterMap->second;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
loadedFileList = newLoadedFileList;
|
loadedFileList = newLoadedFileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1358,7 +1368,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Now check for unused files in the techtree
|
// Now check for unused files in the techtree
|
||||||
std::map<string,vector<string> > foundFileList;
|
std::map<string,vector<pair<string, string> > > foundFileList;
|
||||||
for(unsigned int i = 0; i < pathList.size(); ++i) {
|
for(unsigned int i = 0; i < pathList.size(); ++i) {
|
||||||
string path = pathList[i];
|
string path = pathList[i];
|
||||||
endPathWithSlash(path);
|
endPathWithSlash(path);
|
||||||
@@ -1388,7 +1398,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
replaceAll(file,"//","/");
|
replaceAll(file,"//","/");
|
||||||
replaceAll(file,"\\\\","\\");
|
replaceAll(file,"\\\\","\\");
|
||||||
|
|
||||||
foundFileList[file].push_back(path);
|
foundFileList[file].push_back(make_pair(path,path));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1405,7 +1415,7 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
|
|
||||||
int purgeCount = 0;
|
int purgeCount = 0;
|
||||||
bool foundUnusedFile = false;
|
bool foundUnusedFile = false;
|
||||||
for( std::map<string,vector<string> >::iterator iterMap = foundFileList.begin();
|
for( std::map<string,vector<pair<string, string> > >::iterator iterMap = foundFileList.begin();
|
||||||
iterMap != foundFileList.end(); ++iterMap) {
|
iterMap != foundFileList.end(); ++iterMap) {
|
||||||
string foundFile = iterMap->first;
|
string foundFile = iterMap->first;
|
||||||
|
|
||||||
@@ -1440,16 +1450,29 @@ void runTechValidationForPath(string techPath, string techName,
|
|||||||
|
|
||||||
std::map<int32,vector<string> > mapDuplicateFiles;
|
std::map<int32,vector<string> > mapDuplicateFiles;
|
||||||
// Now check for duplicate data content
|
// Now check for duplicate data content
|
||||||
for(std::map<string,vector<string> >::iterator iterMap = loadedFileList.begin();
|
for(std::map<string,vector<pair<string, string> > >::iterator iterMap = loadedFileList.begin();
|
||||||
iterMap != loadedFileList.end(); iterMap++) {
|
iterMap != loadedFileList.end(); iterMap++) {
|
||||||
string fileName = iterMap->first;
|
string fileName = iterMap->first;
|
||||||
Checksum checksum;
|
Checksum checksum;
|
||||||
checksum.addFile(fileName);
|
checksum.addFile(fileName);
|
||||||
int32 crcValue = checksum.getSum();
|
int32 crcValue = checksum.getSum();
|
||||||
|
// if(crcValue == 0) {
|
||||||
|
// char szBuf[4096]="";
|
||||||
|
// sprintf(szBuf,"Error calculating CRC for file [%s]",fileName.c_str());
|
||||||
|
// throw runtime_error(szBuf);
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// printf("** CRC for file [%s] is [%d] and has %d parents\n",fileName.c_str(),crcValue,(int)iterMap->second.size());
|
||||||
|
// }
|
||||||
mapDuplicateFiles[crcValue].push_back(fileName);
|
mapDuplicateFiles[crcValue].push_back(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double duplicateMegaBytesPurged=0;
|
||||||
|
int duplicateCountPurged=0;
|
||||||
|
|
||||||
double duplicateMegaBytes=0;
|
double duplicateMegaBytes=0;
|
||||||
int duplicateCount=0;
|
int duplicateCount=0;
|
||||||
|
|
||||||
bool foundDuplicates = false;
|
bool foundDuplicates = false;
|
||||||
for(std::map<int32,vector<string> >::iterator iterMap = mapDuplicateFiles.begin();
|
for(std::map<int32,vector<string> >::iterator iterMap = mapDuplicateFiles.begin();
|
||||||
iterMap != mapDuplicateFiles.end(); iterMap++) {
|
iterMap != mapDuplicateFiles.end(); iterMap++) {
|
||||||
@@ -1474,26 +1497,129 @@ 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<pair<string, 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++) {
|
||||||
parentList[iterFind->second[jdx]]++;
|
parentList[iterFind->second[jdx].first]++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(map<string,int>::iterator iterMap = parentList.begin();
|
for(map<string,int>::iterator iterMap1 = parentList.begin();
|
||||||
iterMap != parentList.end(); iterMap++) {
|
iterMap1 != parentList.end(); iterMap1++) {
|
||||||
|
|
||||||
if(iterMap == parentList.begin()) {
|
if(iterMap1 == parentList.begin()) {
|
||||||
printf("\tParents:\n");
|
printf("\tParents:\n");
|
||||||
}
|
}
|
||||||
printf("\t[%s]\n",iterMap->first.c_str());
|
printf("\t[%s]\n",iterMap1->first.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if(purgeDuplicateFiles == true) {
|
||||||
|
string newCommonFileName = "";
|
||||||
|
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
||||||
|
string duplicateFile = fileList[idx];
|
||||||
|
string fileExt = extractExtension(duplicateFile);
|
||||||
|
if(fileExt == "wav" || fileExt == "ogg") {
|
||||||
|
off_t fileSize = getFileSize(duplicateFile);
|
||||||
|
if(idx == 0) {
|
||||||
|
newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile);
|
||||||
|
|
||||||
|
string expandedNewCommonFileName = newCommonFileName;
|
||||||
|
Properties::applyTagsToValue(expandedNewCommonFileName);
|
||||||
|
|
||||||
|
//int result = 0;
|
||||||
|
int result = rename(duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||||
|
if(result != 0) {
|
||||||
|
char szBuf[4096]="";
|
||||||
|
char *errmsg = strerror(errno);
|
||||||
|
sprintf(szBuf,"!!! Error [%s] Could not rename [%s] to [%s]!",errmsg,duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||||
|
throw runtime_error(szBuf);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("*** Duplicate file:\n[%s]\nwas renamed to:\n[%s]\n",duplicateFile.c_str(),expandedNewCommonFileName.c_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
removeFile(duplicateFile);
|
||||||
|
printf("*** Duplicate file:\n[%s]\nwas removed\n",duplicateFile.c_str());
|
||||||
|
|
||||||
|
// convert to MB
|
||||||
|
duplicateMegaBytesPurged += ((double)fileSize / 1048576.0);
|
||||||
|
duplicateCountPurged++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::map<string,int> mapUniqueParentList;
|
||||||
|
|
||||||
|
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
||||||
|
string duplicateFile = fileList[idx];
|
||||||
|
string fileExt = extractExtension(duplicateFile);
|
||||||
|
if(fileExt == "wav" || fileExt == "ogg") {
|
||||||
|
std::map<string,vector<pair<string, string> > >::iterator iterFind2 = loadedFileList.find(duplicateFile);
|
||||||
|
if(iterFind2 != loadedFileList.end()) {
|
||||||
|
for(unsigned int jdx1 = 0; jdx1 < iterFind2->second.size(); jdx1++) {
|
||||||
|
string parentFile = iterFind2->second[jdx1].first;
|
||||||
|
string searchText = iterFind2->second[jdx1].second;
|
||||||
|
|
||||||
|
if(mapUniqueParentList.find(parentFile) == mapUniqueParentList.end()) {
|
||||||
|
printf("*** Searching parent file:\n[%s]\nfor duplicate file reference:\n[%s]\nto replace with newname:\n[%s]\n",parentFile.c_str(),searchText.c_str(),newCommonFileName.c_str());
|
||||||
|
bool foundText = searchAndReplaceTextInFile(parentFile, searchText, newCommonFileName, false);
|
||||||
|
printf("foundText = %d\n",foundText);
|
||||||
|
if(foundText == false) {
|
||||||
|
char szBuf[4096]="";
|
||||||
|
sprintf(szBuf,"Error finding text [%s] in file [%s]",searchText.c_str(),parentFile.c_str());
|
||||||
|
throw runtime_error(szBuf);
|
||||||
|
}
|
||||||
|
mapUniqueParentList[parentFile]++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
string newCommonFileName = "";
|
||||||
|
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
||||||
|
string duplicateFile = fileList[idx];
|
||||||
|
string fileExt = extractExtension(duplicateFile);
|
||||||
|
if(fileExt == "wav" || fileExt == "ogg") {
|
||||||
|
off_t fileSize = getFileSize(duplicateFile);
|
||||||
|
if(idx == 0) {
|
||||||
|
newCommonFileName = "$COMMONDATAPATH/sounds/" + extractFileFromDirectoryPath(duplicateFile);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(unsigned int idx = 0; idx < fileList.size(); ++idx) {
|
||||||
|
string duplicateFile = fileList[idx];
|
||||||
|
string fileExt = extractExtension(duplicateFile);
|
||||||
|
if(fileExt == "wav" || fileExt == "ogg") {
|
||||||
|
std::map<string,vector<pair<string, string> > >::iterator iterFind4 = loadedFileList.find(duplicateFile);
|
||||||
|
if(iterFind4 != loadedFileList.end()) {
|
||||||
|
for(unsigned int jdx = 0; jdx < iterFind4->second.size(); jdx++) {
|
||||||
|
string parentFile = iterFind4->second[jdx].first;
|
||||||
|
string searchText = iterFind4->second[jdx].second;
|
||||||
|
|
||||||
|
//printf("*** Searching parent file:\n[%s]\nfor duplicate file reference:\n[%s]\nto replace with newname:\n[%s]\n",parentFile.c_str(),searchText.c_str(),newCommonFileName.c_str());
|
||||||
|
bool foundText = searchAndReplaceTextInFile(parentFile, searchText, newCommonFileName, true);
|
||||||
|
//printf("foundText = %d\n",foundText);
|
||||||
|
if(foundText == false) {
|
||||||
|
char szBuf[4096]="";
|
||||||
|
sprintf(szBuf,"Error finding text [%s] in file [%s]",searchText.c_str(),parentFile.c_str());
|
||||||
|
throw runtime_error(szBuf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(foundDuplicates == true) {
|
if(foundDuplicates == true) {
|
||||||
printf("Duplicates %.2f MB (%d) in files\n",duplicateMegaBytes,duplicateCount);
|
printf("Duplicates %.2f MB (%d) in files\n",duplicateMegaBytes,duplicateCount);
|
||||||
|
printf("Duplicates purged %.2f MB (%d) in files\n",duplicateMegaBytesPurged,duplicateCountPurged);
|
||||||
|
|
||||||
printf("\nWarning, duplicate files were detected - END:\n");
|
printf("\nWarning, duplicate files were detected - END:\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1512,6 +1638,7 @@ void runTechValidationReport(int argc, char** argv) {
|
|||||||
//disableBacktrace=true;
|
//disableBacktrace=true;
|
||||||
printf("====== Started Validation ======\n");
|
printf("====== Started Validation ======\n");
|
||||||
|
|
||||||
|
bool purgeDuplicateFiles = false;
|
||||||
bool purgeUnusedFiles = false;
|
bool purgeUnusedFiles = false;
|
||||||
double purgedMegaBytes=0;
|
double purgedMegaBytes=0;
|
||||||
Config &config = Config::getInstance();
|
Config &config = Config::getInstance();
|
||||||
@@ -1575,7 +1702,7 @@ void runTechValidationReport(int argc, char** argv) {
|
|||||||
|
|
||||||
printf("Found Scenario [%s] with custom techtree [%s] validating...\n",scenarioName.c_str(),techName.c_str());
|
printf("Found Scenario [%s] with custom techtree [%s] validating...\n",scenarioName.c_str(),techName.c_str());
|
||||||
runTechValidationForPath(techPath, techName, filteredFactionList,
|
runTechValidationForPath(techPath, techName, filteredFactionList,
|
||||||
world, purgeUnusedFiles,purgedMegaBytes);
|
world, purgeUnusedFiles, false, purgedMegaBytes);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
@@ -1654,8 +1781,23 @@ void runTechValidationReport(int argc, char** argv) {
|
|||||||
purgeUnusedFiles = true;
|
purgeUnusedFiles = true;
|
||||||
printf("*NOTE All unused techtree files will be deleted!\n");
|
printf("*NOTE All unused techtree files will be deleted!\n");
|
||||||
}
|
}
|
||||||
|
else if(paramPartTokens[2] == "purgeduplicates") {
|
||||||
|
purgeDuplicateFiles = true;
|
||||||
|
printf("*NOTE All duplicate techtree files will be merged!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(paramPartTokens.size() >= 4) {
|
||||||
|
if(paramPartTokens[3] == "purgeunused") {
|
||||||
|
purgeUnusedFiles = true;
|
||||||
|
printf("*NOTE All unused techtree files will be deleted!\n");
|
||||||
|
}
|
||||||
|
else if(paramPartTokens[3] == "purgeduplicates") {
|
||||||
|
purgeDuplicateFiles = true;
|
||||||
|
printf("*NOTE All duplicate techtree files will be merged!\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1677,7 +1819,7 @@ void runTechValidationReport(int argc, char** argv) {
|
|||||||
std::find(filteredTechTreeList.begin(),filteredTechTreeList.end(),techName) != filteredTechTreeList.end()) {
|
std::find(filteredTechTreeList.begin(),filteredTechTreeList.end(),techName) != filteredTechTreeList.end()) {
|
||||||
|
|
||||||
runTechValidationForPath(techPath, techName, filteredFactionList,
|
runTechValidationForPath(techPath, techName, filteredFactionList,
|
||||||
world, purgeUnusedFiles,purgedMegaBytes);
|
world, purgeUnusedFiles,purgeDuplicateFiles,purgedMegaBytes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
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__);
|
||||||
|
|
||||||
@@ -58,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(parentLoader);
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(parentLoader,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//unit requirements
|
//unit requirements
|
||||||
const XmlNode *unitRequirementsNode= n->getChild("unit-requirements");
|
const XmlNode *unitRequirementsNode= n->getChild("unit-requirements");
|
||||||
@@ -113,7 +113,7 @@ 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,string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList,string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
||||||
|
|
||||||
//stop
|
//stop
|
||||||
@@ -138,7 +138,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ 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,string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList,string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList,parentLoader);
|
||||||
|
|
||||||
//stop
|
//stop
|
||||||
@@ -368,7 +368,7 @@ 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, string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
||||||
|
|
||||||
//move
|
//move
|
||||||
@@ -400,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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,soundFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
startSounds[i]= sound;
|
startSounds[i]= sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -418,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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,soundFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
builtSounds[i]= sound;
|
builtSounds[i]= sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -463,7 +463,7 @@ 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, string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
||||||
|
|
||||||
//move
|
//move
|
||||||
@@ -544,7 +544,7 @@ 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, string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
||||||
|
|
||||||
//move
|
//move
|
||||||
@@ -617,7 +617,7 @@ 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, string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
||||||
|
|
||||||
//produce
|
//produce
|
||||||
@@ -682,7 +682,7 @@ 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, string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader) {
|
||||||
|
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
||||||
|
|
||||||
@@ -739,7 +739,7 @@ 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, string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader) {
|
||||||
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
CommandType::load(id, n, dir, tt, ft, ut, loadedFileList, parentLoader);
|
||||||
|
|
||||||
//morph skill
|
//morph skill
|
||||||
|
@@ -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, string parentLoader);
|
std::map<string,vector<pair<string, 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,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
string parentLoader);
|
||||||
virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
|
virtual string getDesc(const TotalUpgrade *totalUpgrade) const;
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
@@ -141,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
|
|
||||||
@@ -164,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
|
|
||||||
@@ -188,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
|
|
||||||
@@ -216,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
|
|
||||||
@@ -249,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;}
|
||||||
@@ -283,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
|
|
||||||
@@ -312,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
@@ -340,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
@@ -368,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, string parentLoader);
|
std::map<string,vector<pair<string, 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;
|
||||||
|
@@ -37,7 +37,7 @@ FactionType::FactionType() {
|
|||||||
|
|
||||||
//load a faction, given a directory
|
//load a faction, given a directory
|
||||||
void FactionType::load(const string &dir, const TechTree *techTree, Checksum* checksum,
|
void FactionType::load(const string &dir, const TechTree *techTree, Checksum* checksum,
|
||||||
Checksum *techtreeChecksum, std::map<string,vector<string> > &loadedFileList) {
|
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
|
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(currentPath);
|
loadedFileList[path].push_back(make_pair(currentPath,currentPath));
|
||||||
|
|
||||||
const XmlNode *factionNode= xmlTree.getRootNode();
|
const XmlNode *factionNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ void FactionType::load(const string &dir, const TechTree *techTree, Checksum* ch
|
|||||||
if(value) {
|
if(value) {
|
||||||
music= new StrSound();
|
music= new StrSound();
|
||||||
music->open(musicNode->getAttribute("path")->getRestrictedValue(currentPath));
|
music->open(musicNode->getAttribute("path")->getRestrictedValue(currentPath));
|
||||||
loadedFileList[musicNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(currentPath);
|
loadedFileList[musicNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(path,musicNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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__);
|
||||||
|
@@ -48,7 +48,7 @@ public:
|
|||||||
//init
|
//init
|
||||||
FactionType();
|
FactionType();
|
||||||
void load(const string &dir, const TechTree *techTree, Checksum* checksum,
|
void load(const string &dir, const TechTree *techTree, Checksum* checksum,
|
||||||
Checksum *techtreeChecksum, std::map<string,vector<string> > &loadedFileList);
|
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
~FactionType();
|
~FactionType();
|
||||||
|
|
||||||
//get
|
//get
|
||||||
|
@@ -38,7 +38,7 @@ ObjectType::~ObjectType(){
|
|||||||
//Logger::getInstance().add("ObjectType", true);
|
//Logger::getInstance().add("ObjectType", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ObjectType::loadModel(const string &path, std::map<string,vector<string> > *loadedFileList,
|
void ObjectType::loadModel(const string &path, std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
Model *model= Renderer::getInstance().newModel(rsGame);
|
Model *model= Renderer::getInstance().newModel(rsGame);
|
||||||
model->load(path, false, loadedFileList, &parentLoader);
|
model->load(path, false, loadedFileList, &parentLoader);
|
||||||
|
@@ -56,7 +56,7 @@ public:
|
|||||||
~ObjectType();
|
~ObjectType();
|
||||||
void init(int modelCount, int objectClass, bool walkable, int height);
|
void init(int modelCount, int objectClass, bool walkable, int height);
|
||||||
|
|
||||||
void loadModel(const string &path, std::map<string,vector<string> > *loadedFileList=NULL,
|
void loadModel(const string &path, std::map<string,vector<pair<string, string> > > *loadedFileList=NULL,
|
||||||
string parentLoader="");
|
string parentLoader="");
|
||||||
void addParticleSystem(ObjectParticleSystemType *particleSystem);
|
void addParticleSystem(ObjectParticleSystemType *particleSystem);
|
||||||
|
|
||||||
|
@@ -46,7 +46,7 @@ ResourceType::~ResourceType(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtreeChecksum,
|
void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtreeChecksum,
|
||||||
std::map<string,vector<string> > &loadedFileList) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
|
|
||||||
string path, str;
|
string path, str;
|
||||||
Renderer &renderer= Renderer::getInstance();
|
Renderer &renderer= Renderer::getInstance();
|
||||||
@@ -68,7 +68,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
|||||||
//tree
|
//tree
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(currentPath);
|
loadedFileList[path].push_back(make_pair(currentPath,currentPath));
|
||||||
|
|
||||||
const XmlNode *resourceNode= xmlTree.getRootNode();
|
const XmlNode *resourceNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
@@ -76,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(sourceXMLFile);
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//type
|
//type
|
||||||
const XmlNode *typeNode= resourceNode->getChild("type");
|
const XmlNode *typeNode= resourceNode->getChild("type");
|
||||||
@@ -92,7 +92,7 @@ void ResourceType::load(const string &dir, Checksum* checksum, Checksum *techtre
|
|||||||
|
|
||||||
model= renderer.newModel(rsGame);
|
model= renderer.newModel(rsGame);
|
||||||
model->load(modelPath, false, &loadedFileList, &sourceXMLFile);
|
model->load(modelPath, false, &loadedFileList, &sourceXMLFile);
|
||||||
loadedFileList[modelPath].push_back(sourceXMLFile);
|
loadedFileList[modelPath].push_back(make_pair(sourceXMLFile,modelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
if(modelNode->hasChild("particles")){
|
if(modelNode->hasChild("particles")){
|
||||||
const XmlNode *particleNode= modelNode->getChild("particles");
|
const XmlNode *particleNode= modelNode->getChild("particles");
|
||||||
@@ -105,7 +105,7 @@ 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, sourceXMLFile);
|
&Renderer::getInstance(), loadedFileList, sourceXMLFile);
|
||||||
loadedFileList[currentPath + particlePath].push_back(sourceXMLFile);
|
loadedFileList[currentPath + particlePath].push_back(make_pair(sourceXMLFile,particleFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
particleTypes.push_back(objectParticleSystemType);
|
particleTypes.push_back(objectParticleSystemType);
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,7 @@ public:
|
|||||||
ResourceType();
|
ResourceType();
|
||||||
~ResourceType();
|
~ResourceType();
|
||||||
void load(const string &dir, Checksum* checksum,Checksum *techtreeChecksum,
|
void load(const string &dir, Checksum* checksum,Checksum *techtreeChecksum,
|
||||||
std::map<string,vector<string> > &loadedFileList);
|
std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
|
|
||||||
//get
|
//get
|
||||||
int getClass() const {return resourceClass;}
|
int getClass() const {return resourceClass;}
|
||||||
|
@@ -42,7 +42,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
//name
|
//name
|
||||||
name= sn->getChild("name")->getAttribute("value")->getRestrictedValue();
|
name= sn->getChild("name")->getAttribute("value")->getRestrictedValue();
|
||||||
@@ -69,7 +69,7 @@ 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, &parentLoader);
|
animation->load(path, false, &loadedFileList, &parentLoader);
|
||||||
loadedFileList[path].push_back(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,sn->getChild("animation")->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//particles
|
//particles
|
||||||
if(sn->hasChild("particles")) {
|
if(sn->hasChild("particles")) {
|
||||||
@@ -82,7 +82,7 @@ void SkillType::load(const XmlNode *sn, const string &dir, const TechTree *tt,
|
|||||||
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
UnitParticleSystemType *unitParticleSystemType= new UnitParticleSystemType();
|
||||||
unitParticleSystemType->load(dir, currentPath + path, &Renderer::getInstance(),
|
unitParticleSystemType->load(dir, currentPath + path, &Renderer::getInstance(),
|
||||||
loadedFileList,parentLoader);
|
loadedFileList,parentLoader);
|
||||||
loadedFileList[currentPath + path].push_back(parentLoader);
|
loadedFileList[currentPath + path].push_back(make_pair(parentLoader,particleFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
unitParticleSystemTypes.push_back(unitParticleSystemType);
|
unitParticleSystemTypes.push_back(unitParticleSystemType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -99,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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,soundFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
sounds[i]= sound;
|
sounds[i]= sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
||||||
|
|
||||||
@@ -262,10 +262,11 @@ void AttackSkillType::load(const XmlNode *sn, const string &dir, const TechTree
|
|||||||
for(int i=0; i<soundNode->getChildCount(); ++i){
|
for(int i=0; i<soundNode->getChildCount(); ++i){
|
||||||
const XmlNode *soundFileNode= soundNode->getChild("sound-file", i);
|
const XmlNode *soundFileNode= soundNode->getChild("sound-file", i);
|
||||||
string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true);
|
string path= soundFileNode->getAttribute("path")->getRestrictedValue(currentPath, true);
|
||||||
|
//printf("\n\n\n\n!@#$ ---> parentLoader [%s] path [%s] nodeValue [%s] i = %d",parentLoader.c_str(),path.c_str(),soundFileNode->getAttribute("path")->getRestrictedValue().c_str(),i);
|
||||||
|
|
||||||
StaticSound *sound= new StaticSound();
|
StaticSound *sound= new StaticSound();
|
||||||
sound->load(path);
|
sound->load(path);
|
||||||
loadedFileList[path].push_back(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,soundFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
projSounds[i]= sound;
|
projSounds[i]= sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -408,7 +409,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader) {
|
string parentLoader) {
|
||||||
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
SkillType::load(sn, dir, tt, ft, loadedFileList, parentLoader);
|
||||||
|
|
||||||
|
@@ -92,7 +92,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
string parentLoader);
|
||||||
|
|
||||||
//get
|
//get
|
||||||
@@ -163,7 +163,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
string parentLoader);
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ 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<pair<string, string> > > &loadedFileList,
|
||||||
string parentLoader);
|
string parentLoader);
|
||||||
virtual string toString() const;
|
virtual string toString() const;
|
||||||
};
|
};
|
||||||
|
@@ -33,7 +33,7 @@ namespace Glest{ namespace Game{
|
|||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
Checksum TechTree::loadTech(const vector<string> pathList, const string &techName,
|
Checksum TechTree::loadTech(const vector<string> pathList, const string &techName,
|
||||||
set<string> &factions, Checksum* checksum, std::map<string,vector<string> > &loadedFileList) {
|
set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
Checksum techtreeChecksum;
|
Checksum techtreeChecksum;
|
||||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||||
string currentPath = pathList[idx];
|
string currentPath = pathList[idx];
|
||||||
@@ -49,7 +49,7 @@ Checksum TechTree::loadTech(const vector<string> pathList, const string &techNam
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum,
|
void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum,
|
||||||
Checksum *techtreeChecksum, std::map<string,vector<string> > &loadedFileList) {
|
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
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__);
|
||||||
|
|
||||||
string currentPath = dir;
|
string currentPath = dir;
|
||||||
@@ -100,7 +100,7 @@ void TechTree::load(const string &dir, set<string> &factions, Checksum* checksum
|
|||||||
checksumValue.addFile(path);
|
checksumValue.addFile(path);
|
||||||
|
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(currentPath);
|
loadedFileList[path].push_back(make_pair(currentPath,currentPath));
|
||||||
|
|
||||||
const XmlNode *techTreeNode= xmlTree.getRootNode();
|
const XmlNode *techTreeNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
|
@@ -46,9 +46,9 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
Checksum loadTech(const vector<string> pathList, const string &techName,
|
Checksum loadTech(const vector<string> pathList, const string &techName,
|
||||||
set<string> &factions, Checksum* checksum, std::map<string,vector<string> > &loadedFileList);
|
set<string> &factions, Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
void load(const string &dir, set<string> &factions, Checksum* checksum,
|
void load(const string &dir, set<string> &factions, Checksum* checksum,
|
||||||
Checksum *techtreeChecksum, std::map<string,vector<string> > &loadedFileList);
|
Checksum *techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
~TechTree();
|
~TechTree();
|
||||||
Checksum * getChecksumValue() { return &checksumValue; }
|
Checksum * getChecksumValue() { return &checksumValue; }
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@ void UnitType::preLoad(const string &dir) {
|
|||||||
|
|
||||||
void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
||||||
const FactionType *factionType, Checksum* checksum,
|
const FactionType *factionType, Checksum* checksum,
|
||||||
Checksum* techtreeChecksum, std::map<string,vector<string> > &loadedFileList) {
|
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
|||||||
|
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(dir);
|
loadedFileList[path].push_back(make_pair(dir,dir));
|
||||||
|
|
||||||
const XmlNode *unitNode= xmlTree.getRootNode();
|
const XmlNode *unitNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
@@ -296,7 +296,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
|||||||
|
|
||||||
unitParticleSystemType->load(dir, currentPath + path,
|
unitParticleSystemType->load(dir, currentPath + path,
|
||||||
&Renderer::getInstance(),loadedFileList, sourceXMLFile);
|
&Renderer::getInstance(),loadedFileList, sourceXMLFile);
|
||||||
loadedFileList[currentPath + path].push_back(sourceXMLFile);
|
loadedFileList[currentPath + path].push_back(make_pair(sourceXMLFile,particleFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//if(unitParticleSystemType->hasTexture() == false) {
|
//if(unitParticleSystemType->hasTexture() == false) {
|
||||||
//Renderer::getInstance().endLastTexture(rsGame,true);
|
//Renderer::getInstance().endLastTexture(rsGame,true);
|
||||||
@@ -400,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(sourceXMLFile);
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//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(sourceXMLFile);
|
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,imageCancelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//meeting point
|
//meeting point
|
||||||
const XmlNode *meetingPointNode= parametersNode->getChild("meeting-point");
|
const XmlNode *meetingPointNode= parametersNode->getChild("meeting-point");
|
||||||
@@ -414,7 +414,7 @@ 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(sourceXMLFile);
|
loadedFileList[meetingPointNode->getAttribute("image-path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,meetingPointNode->getAttribute("image-path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//selection sounds
|
//selection sounds
|
||||||
@@ -426,7 +426,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
|||||||
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(sourceXMLFile);
|
loadedFileList[path].push_back(make_pair(sourceXMLFile,soundNode->getAttribute("path")->getRestrictedValue()));
|
||||||
selectionSounds[i]= sound;
|
selectionSounds[i]= sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -440,7 +440,7 @@ void UnitType::load(int id,const string &dir, const TechTree *techTree,
|
|||||||
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(sourceXMLFile);
|
loadedFileList[path].push_back(make_pair(sourceXMLFile,soundNode->getAttribute("path")->getRestrictedValue()));
|
||||||
commandSounds[i]= sound;
|
commandSounds[i]= sound;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -138,7 +138,7 @@ public:
|
|||||||
void preLoad(const string &dir);
|
void preLoad(const string &dir);
|
||||||
void load(int id, const string &dir, const TechTree *techTree,
|
void load(int id, const string &dir, const TechTree *techTree,
|
||||||
const FactionType *factionType, Checksum* checksum,
|
const FactionType *factionType, Checksum* checksum,
|
||||||
Checksum* techtreeChecksum, std::map<string,vector<string> > &loadedFileList);
|
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
|
|
||||||
//get
|
//get
|
||||||
int getId() const {return id;}
|
int getId() const {return id;}
|
||||||
|
@@ -49,7 +49,7 @@ void UpgradeType::preLoad(const string &dir){
|
|||||||
|
|
||||||
void UpgradeType::load(const string &dir, const TechTree *techTree,
|
void UpgradeType::load(const string &dir, const TechTree *techTree,
|
||||||
const FactionType *factionType, Checksum* checksum,
|
const FactionType *factionType, Checksum* checksum,
|
||||||
Checksum* techtreeChecksum, std::map<string,vector<string> > &loadedFileList) {
|
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
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__);
|
||||||
|
|
||||||
Logger::getInstance().add("Upgrade type: "+ formatString(name), true);
|
Logger::getInstance().add("Upgrade type: "+ formatString(name), true);
|
||||||
@@ -65,14 +65,14 @@ void UpgradeType::load(const string &dir, const TechTree *techTree,
|
|||||||
|
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(currentPath);
|
loadedFileList[path].push_back(make_pair(currentPath,currentPath));
|
||||||
const XmlNode *upgradeNode= xmlTree.getRootNode();
|
const XmlNode *upgradeNode= xmlTree.getRootNode();
|
||||||
|
|
||||||
//image
|
//image
|
||||||
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(sourceXMLFile);
|
loadedFileList[imageNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//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());
|
||||||
@@ -82,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(sourceXMLFile);
|
loadedFileList[imageCancelNode->getAttribute("path")->getRestrictedValue(currentPath,true)].push_back(make_pair(sourceXMLFile,imageCancelNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
//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());
|
||||||
|
@@ -79,7 +79,7 @@ public:
|
|||||||
void preLoad(const string &dir);
|
void preLoad(const string &dir);
|
||||||
void load(const string &dir, const TechTree *techTree,
|
void load(const string &dir, const TechTree *techTree,
|
||||||
const FactionType *factionType, Checksum* checksum,
|
const FactionType *factionType, Checksum* checksum,
|
||||||
Checksum* techtreeChecksum, std::map<string,vector<string> > &loadedFileList);
|
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
|
|
||||||
//get all
|
//get all
|
||||||
int getEffectCount() const {return effects.size();}
|
int getEffectCount() const {return effects.size();}
|
||||||
|
@@ -32,7 +32,7 @@ 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, string parentLoader) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader) {
|
||||||
string path="";
|
string path="";
|
||||||
|
|
||||||
//day
|
//day
|
||||||
@@ -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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,dayNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,nightNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,rainNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,snowNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,dayStartNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
//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(parentLoader);
|
loadedFileList[path].push_back(make_pair(parentLoader,nightStartNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ void AmbientSounds::load(const string &dir, const XmlNode *xmlNode,
|
|||||||
// =====================================================
|
// =====================================================
|
||||||
|
|
||||||
Checksum Tileset::loadTileset(const vector<string> pathList, const string &tilesetName,
|
Checksum Tileset::loadTileset(const vector<string> pathList, const string &tilesetName,
|
||||||
Checksum* checksum, std::map<string,vector<string> > &loadedFileList) {
|
Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
Checksum tilesetChecksum;
|
Checksum tilesetChecksum;
|
||||||
for(int idx = 0; idx < pathList.size(); idx++) {
|
for(int idx = 0; idx < pathList.size(); idx++) {
|
||||||
string currentPath = pathList[idx];
|
string currentPath = pathList[idx];
|
||||||
@@ -133,7 +133,7 @@ Checksum Tileset::loadTileset(const vector<string> pathList, const string &tiles
|
|||||||
|
|
||||||
|
|
||||||
void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetChecksum,
|
void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetChecksum,
|
||||||
std::map<string,vector<string> > &loadedFileList) {
|
std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
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__);
|
||||||
|
|
||||||
random.init(time(NULL));
|
random.init(time(NULL));
|
||||||
@@ -159,7 +159,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||||||
//parse xml
|
//parse xml
|
||||||
XmlTree xmlTree;
|
XmlTree xmlTree;
|
||||||
xmlTree.load(path);
|
xmlTree.load(path);
|
||||||
loadedFileList[path].push_back(currentPath);
|
loadedFileList[path].push_back(make_pair(currentPath,currentPath));
|
||||||
|
|
||||||
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__);
|
||||||
|
|
||||||
@@ -187,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(sourceXMLFile);
|
loadedFileList[textureNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,textureNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue();
|
surfProbs[i][j]= textureNode->getAttribute("prob")->getFloatValue();
|
||||||
}
|
}
|
||||||
@@ -215,7 +215,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||||||
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, sourceXMLFile);
|
objectTypes[i].loadModel(pathAttribute->getRestrictedValue(currentPath),&loadedFileList, sourceXMLFile);
|
||||||
loadedFileList[pathAttribute->getRestrictedValue(currentPath)].push_back(sourceXMLFile);
|
loadedFileList[pathAttribute->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,pathAttribute->getRestrictedValue()));
|
||||||
|
|
||||||
if(modelNode->hasChild("particles")){
|
if(modelNode->hasChild("particles")){
|
||||||
const XmlNode *particleNode= modelNode->getChild("particles");
|
const XmlNode *particleNode= modelNode->getChild("particles");
|
||||||
@@ -227,7 +227,7 @@ void Tileset::load(const string &dir, Checksum *checksum, Checksum *tilesetCheck
|
|||||||
ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType();
|
ObjectParticleSystemType *objectParticleSystemType= new ObjectParticleSystemType();
|
||||||
objectParticleSystemType->load(dir, currentPath + path,
|
objectParticleSystemType->load(dir, currentPath + path,
|
||||||
&Renderer::getInstance(), loadedFileList, sourceXMLFile);
|
&Renderer::getInstance(), loadedFileList, sourceXMLFile);
|
||||||
loadedFileList[currentPath + path].push_back(sourceXMLFile);
|
loadedFileList[currentPath + path].push_back(make_pair(sourceXMLFile,particleFileNode->getAttribute("path")->getRestrictedValue()));
|
||||||
|
|
||||||
objectTypes[i].addParticleSystem((objectParticleSystemType));
|
objectTypes[i].addParticleSystem((objectParticleSystemType));
|
||||||
}
|
}
|
||||||
@@ -263,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(sourceXMLFile);
|
loadedFileList[waterFrameNode->getAttribute("path")->getRestrictedValue(currentPath)].push_back(make_pair(sourceXMLFile,waterFrameNode->getAttribute("path")->getRestrictedValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
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__);
|
||||||
|
@@ -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,string parentLoader);
|
std::map<string,vector<pair<string, string> > > &loadedFileList,string parentLoader);
|
||||||
};
|
};
|
||||||
|
|
||||||
// =====================================================
|
// =====================================================
|
||||||
@@ -133,9 +133,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
~Tileset();
|
~Tileset();
|
||||||
Checksum loadTileset(const vector<string> pathList, const string &tilesetName,
|
Checksum loadTileset(const vector<string> pathList, const string &tilesetName,
|
||||||
Checksum* checksum, std::map<string,vector<string> > &loadedFileList);
|
Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
void load(const string &dir, Checksum *checksum, Checksum *tilesetChecksum,
|
void load(const string &dir, Checksum *checksum, Checksum *tilesetChecksum,
|
||||||
std::map<string,vector<string> > &loadedFileList);
|
std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
Checksum * getChecksumValue() { return &checksumValue; }
|
Checksum * getChecksumValue() { return &checksumValue; }
|
||||||
|
|
||||||
//get
|
//get
|
||||||
|
@@ -199,7 +199,7 @@ void World::init(Game *game, bool createUnits){
|
|||||||
|
|
||||||
//load tileset
|
//load tileset
|
||||||
Checksum World::loadTileset(const vector<string> pathList, const string &tilesetName,
|
Checksum World::loadTileset(const vector<string> pathList, const string &tilesetName,
|
||||||
Checksum* checksum, std::map<string,vector<string> > &loadedFileList) {
|
Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
Checksum tilsetChecksum;
|
Checksum tilsetChecksum;
|
||||||
|
|
||||||
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__);
|
||||||
@@ -212,7 +212,7 @@ Checksum World::loadTileset(const vector<string> pathList, const string &tileset
|
|||||||
return tilsetChecksum;
|
return tilsetChecksum;
|
||||||
}
|
}
|
||||||
|
|
||||||
Checksum World::loadTileset(const string &dir, Checksum *checksum, std::map<string,vector<string> > &loadedFileList) {
|
Checksum World::loadTileset(const string &dir, Checksum *checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
Checksum tilesetChecksum;
|
Checksum tilesetChecksum;
|
||||||
|
|
||||||
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__);
|
||||||
@@ -226,7 +226,7 @@ Checksum World::loadTileset(const string &dir, Checksum *checksum, std::map<stri
|
|||||||
|
|
||||||
//load tech
|
//load tech
|
||||||
Checksum World::loadTech(const vector<string> pathList, const string &techName,
|
Checksum World::loadTech(const vector<string> pathList, const string &techName,
|
||||||
set<string> &factions, Checksum *checksum, std::map<string,vector<string> > &loadedFileList) {
|
set<string> &factions, Checksum *checksum, std::map<string,vector<pair<string, string> > > &loadedFileList) {
|
||||||
Checksum techtreeChecksum;
|
Checksum techtreeChecksum;
|
||||||
|
|
||||||
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__);
|
||||||
|
@@ -174,11 +174,11 @@ public:
|
|||||||
//init & load
|
//init & load
|
||||||
void init(Game *game, bool createUnits);
|
void init(Game *game, bool createUnits);
|
||||||
Checksum loadTileset(const vector<string> pathList, const string &tilesetName,
|
Checksum loadTileset(const vector<string> pathList, const string &tilesetName,
|
||||||
Checksum* checksum, std::map<string,vector<string> > &loadedFileList);
|
Checksum* checksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
Checksum loadTileset(const string &dir, Checksum* checksum,
|
Checksum loadTileset(const string &dir, Checksum* checksum,
|
||||||
std::map<string,vector<string> > &loadedFileList);
|
std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
Checksum loadTech(const vector<string> pathList, const string &techName,
|
Checksum loadTech(const vector<string> pathList, const string &techName,
|
||||||
set<string> &factions, Checksum* checksum,std::map<string,vector<string> > &loadedFileList);
|
set<string> &factions, Checksum* checksum,std::map<string,vector<pair<string, string> > > &loadedFileList);
|
||||||
Checksum loadMap(const string &path, Checksum* checksum);
|
Checksum loadMap(const string &path, Checksum* checksum);
|
||||||
Checksum loadScenario(const string &path, Checksum* checksum);
|
Checksum loadScenario(const string &path, Checksum* checksum);
|
||||||
|
|
||||||
|
@@ -133,15 +133,15 @@ public:
|
|||||||
|
|
||||||
Texture2D *loadMeshTexture(int meshIndex, int textureIndex, TextureManager *textureManager, string textureFile,
|
Texture2D *loadMeshTexture(int meshIndex, int textureIndex, TextureManager *textureManager, string textureFile,
|
||||||
int textureChannelCount, bool &textureOwned,
|
int textureChannelCount, bool &textureOwned,
|
||||||
bool deletePixMapAfterLoad, std::map<string,vector<string> > *loadedFileList=NULL,
|
bool deletePixMapAfterLoad, std::map<string,vector<pair<string, string> > > *loadedFileList=NULL,
|
||||||
string sourceLoader="");
|
string sourceLoader="");
|
||||||
|
|
||||||
//load
|
//load
|
||||||
void loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
void loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
||||||
bool deletePixMapAfterLoad,std::map<string,vector<string> > *loadedFileList=NULL,string sourceLoader="");
|
bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL,string sourceLoader="");
|
||||||
void loadV3(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
void loadV3(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
||||||
bool deletePixMapAfterLoad,std::map<string,vector<string> > *loadedFileList=NULL,string sourceLoader="");
|
bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL,string sourceLoader="");
|
||||||
void load(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,bool deletePixMapAfterLoad,std::map<string,vector<string> > *loadedFileList=NULL,string sourceLoader="");
|
void load(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL,string sourceLoader="");
|
||||||
void save(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
void save(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
||||||
string convertTextureToFormat, std::map<string,int> &textureDeleteList,
|
string convertTextureToFormat, std::map<string,int> &textureDeleteList,
|
||||||
bool keepsmallest);
|
bool keepsmallest);
|
||||||
@@ -198,9 +198,9 @@ public:
|
|||||||
uint32 getVertexCount() const;
|
uint32 getVertexCount() const;
|
||||||
|
|
||||||
//io
|
//io
|
||||||
void load(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<string> > *loadedFileList=NULL, string *sourceLoader=NULL);
|
void load(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string *sourceLoader=NULL);
|
||||||
void save(const string &path, string convertTextureToFormat,bool keepsmallest);
|
void save(const string &path, string convertTextureToFormat,bool keepsmallest);
|
||||||
void loadG3d(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<string> > *loadedFileList=NULL, string sourceLoader="");
|
void loadG3d(const string &path,bool deletePixMapAfterLoad=false,std::map<string,vector<pair<string, string> > > *loadedFileList=NULL, string sourceLoader="");
|
||||||
void saveG3d(const string &path, string convertTextureToFormat,bool keepsmallest);
|
void saveG3d(const string &path, string convertTextureToFormat,bool keepsmallest);
|
||||||
|
|
||||||
void setTextureManager(TextureManager *textureManager) {this->textureManager= textureManager;}
|
void setTextureManager(TextureManager *textureManager) {this->textureManager= textureManager;}
|
||||||
|
@@ -174,6 +174,7 @@ bool removeFile(string file);
|
|||||||
bool renameFile(string oldFile, string newFile);
|
bool renameFile(string oldFile, string newFile);
|
||||||
void removeFolder(const string path);
|
void removeFolder(const string path);
|
||||||
off_t getFileSize(string filename);
|
off_t getFileSize(string filename);
|
||||||
|
bool searchAndReplaceTextInFile(string fileName, string findText, string replaceText, bool simulateOnly);
|
||||||
|
|
||||||
int getScreenW();
|
int getScreenW();
|
||||||
int getScreenH();
|
int getScreenH();
|
||||||
|
@@ -208,7 +208,7 @@ string Mesh::findAlternateTexture(vector<string> conversionList, string textureF
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
||||||
bool deletePixMapAfterLoad, std::map<string,vector<string> > *loadedFileList,
|
bool deletePixMapAfterLoad, std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||||
string sourceLoader) {
|
string sourceLoader) {
|
||||||
this->textureManager = textureManager;
|
this->textureManager = textureManager;
|
||||||
//read header
|
//read header
|
||||||
@@ -270,7 +270,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex
|
|||||||
textures[mtDiffuse]= textureManager->newTexture2D();
|
textures[mtDiffuse]= textureManager->newTexture2D();
|
||||||
textures[mtDiffuse]->load(texPath);
|
textures[mtDiffuse]->load(texPath);
|
||||||
if(loadedFileList) {
|
if(loadedFileList) {
|
||||||
(*loadedFileList)[texPath].push_back(sourceLoader);
|
(*loadedFileList)[texPath].push_back(make_pair(sourceLoader,sourceLoader));
|
||||||
}
|
}
|
||||||
texturesOwned[mtDiffuse]=true;
|
texturesOwned[mtDiffuse]=true;
|
||||||
textures[mtDiffuse]->init(textureManager->getTextureFilter(),textureManager->getMaxAnisotropy());
|
textures[mtDiffuse]->init(textureManager->getTextureFilter(),textureManager->getMaxAnisotropy());
|
||||||
@@ -298,7 +298,7 @@ void Mesh::loadV2(int meshIndex, const string &dir, FILE *f, TextureManager *tex
|
|||||||
|
|
||||||
void Mesh::loadV3(int meshIndex, const string &dir, FILE *f,
|
void Mesh::loadV3(int meshIndex, const string &dir, FILE *f,
|
||||||
TextureManager *textureManager,bool deletePixMapAfterLoad,
|
TextureManager *textureManager,bool deletePixMapAfterLoad,
|
||||||
std::map<string,vector<string> > *loadedFileList,
|
std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||||
string sourceLoader) {
|
string sourceLoader) {
|
||||||
this->textureManager = textureManager;
|
this->textureManager = textureManager;
|
||||||
|
|
||||||
@@ -357,7 +357,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f,
|
|||||||
textures[mtDiffuse]= textureManager->newTexture2D();
|
textures[mtDiffuse]= textureManager->newTexture2D();
|
||||||
textures[mtDiffuse]->load(texPath);
|
textures[mtDiffuse]->load(texPath);
|
||||||
if(loadedFileList) {
|
if(loadedFileList) {
|
||||||
(*loadedFileList)[texPath].push_back(sourceLoader);
|
(*loadedFileList)[texPath].push_back(make_pair(sourceLoader,sourceLoader));
|
||||||
}
|
}
|
||||||
|
|
||||||
texturesOwned[mtDiffuse]=true;
|
texturesOwned[mtDiffuse]=true;
|
||||||
@@ -389,7 +389,7 @@ void Mesh::loadV3(int meshIndex, const string &dir, FILE *f,
|
|||||||
Texture2D* Mesh::loadMeshTexture(int meshIndex, int textureIndex,
|
Texture2D* Mesh::loadMeshTexture(int meshIndex, int textureIndex,
|
||||||
TextureManager *textureManager, string textureFile,
|
TextureManager *textureManager, string textureFile,
|
||||||
int textureChannelCount, bool &textureOwned, bool deletePixMapAfterLoad,
|
int textureChannelCount, bool &textureOwned, bool deletePixMapAfterLoad,
|
||||||
std::map<string,vector<string> > *loadedFileList,
|
std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||||
string sourceLoader) {
|
string sourceLoader) {
|
||||||
|
|
||||||
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s] #1 load texture [%s]\n",__FUNCTION__,textureFile.c_str());
|
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s] #1 load texture [%s]\n",__FUNCTION__,textureFile.c_str());
|
||||||
@@ -416,7 +416,7 @@ Texture2D* Mesh::loadMeshTexture(int meshIndex, int textureIndex,
|
|||||||
}
|
}
|
||||||
texture->load(textureFile);
|
texture->load(textureFile);
|
||||||
if(loadedFileList) {
|
if(loadedFileList) {
|
||||||
(*loadedFileList)[textureFile].push_back(sourceLoader);
|
(*loadedFileList)[textureFile].push_back(make_pair(sourceLoader,sourceLoader));
|
||||||
}
|
}
|
||||||
|
|
||||||
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s] texture loaded [%s]\n",__FUNCTION__,textureFile.c_str());
|
//if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s] texture loaded [%s]\n",__FUNCTION__,textureFile.c_str());
|
||||||
@@ -439,7 +439,7 @@ Texture2D* Mesh::loadMeshTexture(int meshIndex, int textureIndex,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
void Mesh::load(int meshIndex, const string &dir, FILE *f, TextureManager *textureManager,
|
||||||
bool deletePixMapAfterLoad,std::map<string,vector<string> > *loadedFileList,
|
bool deletePixMapAfterLoad,std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||||
string sourceLoader) {
|
string sourceLoader) {
|
||||||
this->textureManager = textureManager;
|
this->textureManager = textureManager;
|
||||||
|
|
||||||
@@ -770,7 +770,7 @@ uint32 Model::getVertexCount() const {
|
|||||||
// ==================== io ====================
|
// ==================== io ====================
|
||||||
|
|
||||||
void Model::load(const string &path, bool deletePixMapAfterLoad,
|
void Model::load(const string &path, bool deletePixMapAfterLoad,
|
||||||
std::map<string,vector<string> > *loadedFileList, string *sourceLoader) {
|
std::map<string,vector<pair<string, string> > > *loadedFileList, string *sourceLoader) {
|
||||||
|
|
||||||
this->sourceLoader = (sourceLoader != NULL ? *sourceLoader : "");
|
this->sourceLoader = (sourceLoader != NULL ? *sourceLoader : "");
|
||||||
this->fileName = path;
|
this->fileName = path;
|
||||||
@@ -797,7 +797,7 @@ void Model::save(const string &path, string convertTextureToFormat,
|
|||||||
|
|
||||||
//load a model from a g3d file
|
//load a model from a g3d file
|
||||||
void Model::loadG3d(const string &path, bool deletePixMapAfterLoad,
|
void Model::loadG3d(const string &path, bool deletePixMapAfterLoad,
|
||||||
std::map<string,vector<string> > *loadedFileList,
|
std::map<string,vector<pair<string, string> > > *loadedFileList,
|
||||||
string sourceLoader) {
|
string sourceLoader) {
|
||||||
|
|
||||||
try{
|
try{
|
||||||
@@ -808,7 +808,7 @@ void Model::loadG3d(const string &path, bool deletePixMapAfterLoad,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(loadedFileList) {
|
if(loadedFileList) {
|
||||||
(*loadedFileList)[path].push_back(sourceLoader);
|
(*loadedFileList)[path].push_back(make_pair(sourceLoader,sourceLoader));
|
||||||
}
|
}
|
||||||
|
|
||||||
string dir= extractDirectoryPathFromFile(path);
|
string dir= extractDirectoryPathFromFile(path);
|
||||||
|
@@ -1793,6 +1793,48 @@ string executable_path(string exeName, bool includeExeNameInPath) {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool searchAndReplaceTextInFile(string fileName, string findText, string replaceText, bool simulateOnly) {
|
||||||
|
bool replacedText = false;
|
||||||
|
const int MAX_LEN_SINGLE_LINE = 4096;
|
||||||
|
char buffer[MAX_LEN_SINGLE_LINE+2];
|
||||||
|
char *buff_ptr, *find_ptr;
|
||||||
|
FILE *fp1, *fp2;
|
||||||
|
size_t find_len = findText.length();
|
||||||
|
|
||||||
|
string tempfileName = fileName + "_tmp";
|
||||||
|
fp1 = fopen(fileName.c_str(),"r");
|
||||||
|
fp2 = fopen(tempfileName.c_str(),"w");
|
||||||
|
|
||||||
|
while(fgets(buffer,MAX_LEN_SINGLE_LINE + 2,fp1)) {
|
||||||
|
buff_ptr = buffer;
|
||||||
|
while ((find_ptr = strstr(buff_ptr,findText.c_str()))) {
|
||||||
|
//printf("Replacing text [%s] with [%s] in file [%s]\n",findText.c_str(),replaceText.c_str(),fileName.c_str());
|
||||||
|
|
||||||
|
while(buff_ptr < find_ptr) {
|
||||||
|
fputc((int)*buff_ptr++,fp2);
|
||||||
|
}
|
||||||
|
fputs(replaceText.c_str(),fp2);
|
||||||
|
|
||||||
|
buff_ptr += find_len;
|
||||||
|
replacedText = true;
|
||||||
|
}
|
||||||
|
fputs(buff_ptr,fp2);
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(fp2);
|
||||||
|
fclose(fp1);
|
||||||
|
|
||||||
|
if(replacedText == true && simulateOnly == false) {
|
||||||
|
removeFile(fileName);
|
||||||
|
renameFile(tempfileName,fileName);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
removeFile(tempfileName);
|
||||||
|
}
|
||||||
|
//removeFile(tempfileName);
|
||||||
|
return replacedText;
|
||||||
|
}
|
||||||
|
|
||||||
// =====================================
|
// =====================================
|
||||||
// ModeInfo
|
// ModeInfo
|
||||||
// =====================================
|
// =====================================
|
||||||
|
Reference in New Issue
Block a user