diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-08-27 21:18:46 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-08-27 21:44:17 +0300 |
commit | 7c79aa2b8e484319e3e511fa21db6d2448347024 (patch) | |
tree | 3c4fb4e72414dd8c0d93401a6bf2cc86b65a34a0 /src/gui/questswindow.cpp | |
parent | de476bb95242e10c833394ef007728072eabe60f (diff) | |
download | mv-7c79aa2b8e484319e3e511fa21db6d2448347024.tar.gz mv-7c79aa2b8e484319e3e511fa21db6d2448347024.tar.bz2 mv-7c79aa2b8e484319e3e511fa21db6d2448347024.tar.xz mv-7c79aa2b8e484319e3e511fa21db6d2448347024.zip |
Add const to more classes.
Diffstat (limited to 'src/gui/questswindow.cpp')
-rw-r--r-- | src/gui/questswindow.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/gui/questswindow.cpp b/src/gui/questswindow.cpp index d9f039fa8..51ad76505 100644 --- a/src/gui/questswindow.cpp +++ b/src/gui/questswindow.cpp @@ -47,7 +47,7 @@ struct QuestItemText { - QuestItemText(std::string text0, int type0) : + QuestItemText(std::string text0, const int type0) : text(text0), type(type0) { } @@ -168,7 +168,7 @@ QuestsWindow::~QuestsWindow() void QuestsWindow::loadXml() { XML::Document doc("quests.xml"); - XmlNodePtr root = doc.rootNode(); + const XmlNodePtr root = doc.rootNode(); if (!root) return; @@ -176,7 +176,7 @@ void QuestsWindow::loadXml() { if (xmlNameEqual(varNode, "var")) { - int id = XML::getProperty(varNode, "id", 0); + const int id = XML::getProperty(varNode, "id", 0); if (id < 0) continue; for_each_xml_child_node(questNode, varNode) @@ -188,7 +188,7 @@ void QuestsWindow::loadXml() } } -void QuestsWindow::loadQuest(int var, XmlNodePtr node) +void QuestsWindow::loadQuest(const int var, const XmlNodePtr node) { QuestItem *quest = new QuestItem(); quest->name = XML::langProperty(node, "name", _("unknown")); @@ -213,7 +213,7 @@ void QuestsWindow::loadQuest(int var, XmlNodePtr node) { if (!xmlTypeEqual(dataNode, XML_ELEMENT_NODE)) continue; - const char *data = reinterpret_cast<const char*>( + const char *const data = reinterpret_cast<const char*>( xmlNodeGetContent(dataNode)); if (!data) continue; @@ -232,7 +232,7 @@ void QuestsWindow::action(const gcn::ActionEvent &event) const std::string &eventId = event.getId(); if (eventId == "select") { - int id = mQuestsListBox->getSelected(); + const int id = mQuestsListBox->getSelected(); if (id < 0) return; showQuest(mQuestLinks[id]); @@ -243,12 +243,12 @@ void QuestsWindow::action(const gcn::ActionEvent &event) } } -void QuestsWindow::updateQuest(int var, int val) +void QuestsWindow::updateQuest(const int var, const int val) { mVars[var] = val; } -void QuestsWindow::rebuild(bool playSound) +void QuestsWindow::rebuild(const bool playSound) { mQuestsModel->clear(); mQuestLinks.clear(); @@ -262,15 +262,15 @@ void QuestsWindow::rebuild(bool playSound) for (std::map<int, int>::const_iterator it = mVars.begin(), it_end = mVars.end(); it != it_end; ++ it) { - int var = (*it).first; - int val = (*it).second; + const int var = (*it).first; + const int val = (*it).second; const std::vector<QuestItem*> &quests = mQuests[var]; for (std::vector<QuestItem*>::const_iterator it2 = quests.begin(), it2_end = quests.end(); it2 != it2_end; ++ it2) { if (!*it2) continue; - QuestItem *quest = *it2; + QuestItem *const quest = *it2; // complete quest if (quest->complete.find(val) != quest->complete.end()) complete.push_back(quest); @@ -285,7 +285,7 @@ void QuestsWindow::rebuild(bool playSound) for (std::vector<QuestItem*>::const_iterator it = complete.begin(), it_end = complete.end(); it != it_end; ++ it, k ++) { - QuestItem *quest = *it; + QuestItem *const quest = *it; if (quest->completeFlag == 0) { updatedQuest = k; @@ -308,7 +308,7 @@ void QuestsWindow::rebuild(bool playSound) for (std::vector<QuestItem*>::const_iterator it = incomplete.begin(), it_end = incomplete.end(); it != it_end; ++ it, k ++) { - QuestItem *quest = *it; + QuestItem *const quest = *it; if (quest->completeFlag == -1) { updatedQuest = k; @@ -353,7 +353,7 @@ void QuestsWindow::rebuild(bool playSound) } } -void QuestsWindow::showQuest(QuestItem *quest) +void QuestsWindow::showQuest(const QuestItem *const quest) { if (!quest) return; |