summaryrefslogtreecommitdiff
path: root/src/gui/windows/questswindow.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-04 02:36:11 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-04 02:36:11 +0300
commit18e46c191ce38819cc6fa2f720726bbb6115c613 (patch)
tree8ff5f70cc0e0b19bbb9ceb08f573f3e50f688089 /src/gui/windows/questswindow.cpp
parent310e966a513f456538d8fd1bb02e5878ce24bc2d (diff)
downloadmanaverse-18e46c191ce38819cc6fa2f720726bbb6115c613.tar.gz
manaverse-18e46c191ce38819cc6fa2f720726bbb6115c613.tar.bz2
manaverse-18e46c191ce38819cc6fa2f720726bbb6115c613.tar.xz
manaverse-18e46c191ce38819cc6fa2f720726bbb6115c613.zip
Add support for cooridinates tag with x and y in quests.xml
Diffstat (limited to 'src/gui/windows/questswindow.cpp')
-rw-r--r--src/gui/windows/questswindow.cpp46
1 files changed, 38 insertions, 8 deletions
diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp
index 5bdf85b36..9e46cca50 100644
--- a/src/gui/windows/questswindow.cpp
+++ b/src/gui/windows/questswindow.cpp
@@ -235,28 +235,50 @@ void QuestsWindow::loadQuest(const int var, const XmlNodePtr node)
if (xmlNameEqual(dataNode, "text"))
{
- quest->texts.push_back(QuestItemText(str, QuestType::TEXT));
+ quest->texts.push_back(QuestItemText(str,
+ QuestType::TEXT,
+ std::string(),
+ std::string()));
}
else if (xmlNameEqual(dataNode, "name"))
{
- quest->texts.push_back(QuestItemText(str, QuestType::NAME));
+ quest->texts.push_back(QuestItemText(str,
+ QuestType::NAME,
+ std::string(),
+ std::string()));
}
else if (xmlNameEqual(dataNode, "reward"))
{
- quest->texts.push_back(QuestItemText(str, QuestType::REWARD));
+ quest->texts.push_back(QuestItemText(str,
+ QuestType::REWARD,
+ std::string(),
+ std::string()));
}
else if (xmlNameEqual(dataNode, "questgiver") ||
xmlNameEqual(dataNode, "giver"))
{
- quest->texts.push_back(QuestItemText(str, QuestType::GIVER));
+ quest->texts.push_back(QuestItemText(str,
+ QuestType::GIVER,
+ std::string(),
+ std::string()));
}
else if (xmlNameEqual(dataNode, "coordinates"))
{
- quest->texts.push_back(QuestItemText(str, QuestType::COORDINATES));
+ const std::string str1 = toString(XML::getIntProperty(
+ dataNode, "x", 0, 1, 1000));
+ const std::string str2 = toString(XML::getIntProperty(
+ dataNode, "y", 0, 1, 1000));
+ quest->texts.push_back(QuestItemText(str,
+ QuestType::COORDINATES,
+ str1,
+ str2));
}
else if (xmlNameEqual(dataNode, "npc"))
{
- quest->texts.push_back(QuestItemText(str, QuestType::NPC));
+ quest->texts.push_back(QuestItemText(str,
+ QuestType::NPC,
+ std::string(),
+ std::string()));
}
}
mQuests[var].push_back(quest);
@@ -428,7 +450,6 @@ void QuestsWindow::showQuest(const QuestItem *const quest)
const QuestItemText &data = *it;
switch (data.type)
{
- case QuestType::COORDINATES:
case QuestType::TEXT:
default:
mText->addRow(data.text);
@@ -452,11 +473,20 @@ void QuestsWindow::showQuest(const QuestItem *const quest)
break;
case QuestType::NPC:
mText->addRow(std::string(
- // TRANSLATORS: npc name
+ // TRANSLATORS: quest npc name
_("Npc:")).append(
" ").append(
data.text));
break;
+ case QuestType::COORDINATES:
+ mText->addRow(std::string(
+ strprintf("%s [@@=navigate %s %s|%s@@]",
+ // TRANSLATORS: quest coordinates
+ _("Coordinates:"),
+ data.data1.c_str(),
+ data.data2.c_str(),
+ data.text.c_str())));
+ break;
}
}
}