mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
added ability to reference sound and videos in lua using variables: {TECHTREEPATH}, {SCENARIOPATH}, {TUTORIALPATH} example:
playStreamingSound('{SCENARIOPATH}/music/myambient.ogg')
This commit is contained in:
@@ -49,6 +49,10 @@ private:
|
||||
static string applicationPath;
|
||||
static string gameVersion;
|
||||
|
||||
static string techtreePath;
|
||||
static string scenarioPath;
|
||||
static string tutorialPath;
|
||||
|
||||
public:
|
||||
static void setApplicationPath(string value) { applicationPath=value; }
|
||||
static string getApplicationPath() { return applicationPath; }
|
||||
@@ -56,6 +60,13 @@ public:
|
||||
static void setGameVersion(string value) { gameVersion=value; }
|
||||
static string getGameVersion() { return gameVersion; }
|
||||
|
||||
static void setTechtreePath(string value) { techtreePath=value; }
|
||||
static string getTechtreePath() { return techtreePath; }
|
||||
static void setScenarioPath(string value) { scenarioPath=value; }
|
||||
static string getScenarioPath() { return scenarioPath; }
|
||||
static void setTutorialPath(string value) { tutorialPath=value; }
|
||||
static string getTutorialPath() { return tutorialPath; }
|
||||
|
||||
void clear();
|
||||
void load(const string &path,bool clearCurrentProperties=true);
|
||||
void save(const string &path);
|
||||
|
@@ -43,6 +43,10 @@ namespace Shared{ namespace Util{
|
||||
string Properties::applicationPath = "";
|
||||
string Properties::gameVersion = "";
|
||||
|
||||
string Properties::techtreePath = "";
|
||||
string Properties::scenarioPath = "";
|
||||
string Properties::tutorialPath = "";
|
||||
|
||||
// =====================================================
|
||||
// class Properties
|
||||
// =====================================================
|
||||
@@ -232,6 +236,10 @@ std::map<string,string> Properties::getTagReplacementValues(std::map<string,stri
|
||||
|
||||
#endif
|
||||
|
||||
mapTagReplacementValues["{TECHTREEPATH}"] = Properties::techtreePath;
|
||||
mapTagReplacementValues["{SCENARIOPATH}"] = Properties::scenarioPath;
|
||||
mapTagReplacementValues["{TUTORIALPATH}"] = Properties::tutorialPath;
|
||||
|
||||
mapTagReplacementValues["$GAMEVERSION"] = Properties::gameVersion;
|
||||
|
||||
//
|
||||
@@ -258,7 +266,15 @@ bool Properties::applyTagsToValue(string &value, const std::map<string,string> *
|
||||
if(mapTagReplacementValues != NULL) {
|
||||
for(std::map<string,string>::const_iterator iterMap = mapTagReplacementValues->begin();
|
||||
iterMap != mapTagReplacementValues->end(); ++iterMap) {
|
||||
|
||||
// if(value.find("{SCENARIOPATH}") != string::npos) {
|
||||
// printf("\n\n** WILL REPLACE [%s]\n",value.c_str());
|
||||
// replaceAll(value, "{SCENARIOPATH}", Properties::scenarioPath);
|
||||
// printf("** REPLACED [%s]\n\n",value.c_str());
|
||||
// }
|
||||
// else {
|
||||
replaceAll(value, iterMap->first, iterMap->second);
|
||||
// }
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -319,6 +335,14 @@ bool Properties::applyTagsToValue(string &value, const std::map<string,string> *
|
||||
|
||||
#endif
|
||||
|
||||
replaceAll(value, "{TECHTREEPATH}", Properties::techtreePath);
|
||||
// if(value.find("{SCENARIOPATH}") != string::npos) {
|
||||
// printf("\n\n** WILL REPLACE [%s]\n",value.c_str());
|
||||
replaceAll(value, "{SCENARIOPATH}", Properties::scenarioPath);
|
||||
// printf("** REPLACED [%s]\n\n",value.c_str());
|
||||
// }
|
||||
replaceAll(value, "{TUTORIALPATH}", Properties::tutorialPath);
|
||||
|
||||
replaceAll(value, "$GAMEVERSION", Properties::gameVersion);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user