diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-04 03:25:31 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-04 03:25:31 +0300 |
commit | 9c52e6525e338da2170a86e57cefc0fe1c6701e3 (patch) | |
tree | 1f02dbe96864b3992bf14791606607d83b808e8c /src/gui | |
parent | 18e46c191ce38819cc6fa2f720726bbb6115c613 (diff) | |
download | manaverse-9c52e6525e338da2170a86e57cefc0fe1c6701e3.tar.gz manaverse-9c52e6525e338da2170a86e57cefc0fe1c6701e3.tar.bz2 manaverse-9c52e6525e338da2170a86e57cefc0fe1c6701e3.tar.xz manaverse-9c52e6525e338da2170a86e57cefc0fe1c6701e3.zip |
Add parameters support for quest texts in quests.xml
Example:
<text text1="line">test {@@1}</text>
Parameters cant be translated.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/windows/questswindow.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 9e46cca50..080c0bdd2 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -233,6 +233,17 @@ void QuestsWindow::loadQuest(const int var, const XmlNodePtr node) std::string str = translator->getStr(data); replaceItemLinks(str); + for (int f = 1; f < 100; f ++) + { + const std::string key = strprintf("text%d", f); + const std::string val = XML::getProperty(dataNode, + key.c_str(), + ""); + if (val.empty()) + break; + const std::string param = strprintf("{@@%d}", f); + replaceAll(str, param, val); + } if (xmlNameEqual(dataNode, "text")) { quest->texts.push_back(QuestItemText(str, |