diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-03-04 02:36:11 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-03-04 02:36:11 +0300 |
commit | 18e46c191ce38819cc6fa2f720726bbb6115c613 (patch) | |
tree | 8ff5f70cc0e0b19bbb9ceb08f573f3e50f688089 /src | |
parent | 310e966a513f456538d8fd1bb02e5878ce24bc2d (diff) | |
download | manaplus-18e46c191ce38819cc6fa2f720726bbb6115c613.tar.gz manaplus-18e46c191ce38819cc6fa2f720726bbb6115c613.tar.bz2 manaplus-18e46c191ce38819cc6fa2f720726bbb6115c613.tar.xz manaplus-18e46c191ce38819cc6fa2f720726bbb6115c613.zip |
Add support for cooridinates tag with x and y in quests.xml
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/windows/questswindow.cpp | 46 | ||||
-rw-r--r-- | src/resources/questitemtext.h | 12 |
2 files changed, 48 insertions, 10 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; } } } diff --git a/src/resources/questitemtext.h b/src/resources/questitemtext.h index 01d6706ea..2667acc35 100644 --- a/src/resources/questitemtext.h +++ b/src/resources/questitemtext.h @@ -29,13 +29,21 @@ struct QuestItemText final { - QuestItemText(const std::string &text0, const QuestTypeT type0) : - text(text0), type(type0) + QuestItemText(const std::string &text0, + const QuestTypeT type0, + const std::string &str1, + const std::string &str2) : + text(text0), + type(type0), + data1(str1), + data2(str2) { } std::string text; QuestTypeT type; + std::string data1; + std::string data2; }; #endif // RESOURCES_QUESTITEMTEXT_H |