diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-16 17:54:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-16 17:54:43 +0300 |
commit | 5a007084e304048549233118707f5ab44f067e1a (patch) | |
tree | bf4ae0fc5296b8275f1d66a0b08044ed5f8b88a2 /src | |
parent | 56b2915de96cf2a94f876b5e56fad2f34cff8052 (diff) | |
download | plus-5a007084e304048549233118707f5ab44f067e1a.tar.gz plus-5a007084e304048549233118707f5ab44f067e1a.tar.bz2 plus-5a007084e304048549233118707f5ab44f067e1a.tar.xz plus-5a007084e304048549233118707f5ab44f067e1a.zip |
Move questtype into separate file.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/gui/windows/questswindow.cpp | 20 | ||||
-rw-r--r-- | src/resources/questtype.h | 34 |
4 files changed, 43 insertions, 13 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9f2cd061e..4d8d2b512 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -538,6 +538,7 @@ SET(SRCS resources/questeffect.h resources/questitem.h resources/questitemtext.h + resources/questtype.h resources/db/palettedb.cpp resources/db/palettedb.h resources/db/petdb.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 50e060294..b9707fe80 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -634,6 +634,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ resources/questeffect.h \ resources/questitem.h \ resources/questitemtext.h \ + resources/questtype.h \ resources/db/palettedb.cpp \ resources/db/palettedb.h \ resources/db/petdb.cpp \ diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 6ed7d6650..f07d6f6b2 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -49,18 +49,12 @@ #include "resources/beingcommon.h" #include "resources/questeffect.h" #include "resources/questitem.h" +#include "resources/questtype.h" #include "resources/map/map.h" #include "debug.h" -enum QuestType -{ - QUEST_TEXT = 0, - QUEST_NAME = 1, - QUEST_REWARD = 2 -}; - QuestsWindow::QuestsWindow() : // TRANSLATORS: quests window name Window(_("Quests"), false, nullptr, "quests.xml"), @@ -230,11 +224,11 @@ void QuestsWindow::loadQuest(const int var, const XmlNodePtr node) std::string str = translator->getStr(data); if (xmlNameEqual(dataNode, "text")) - quest->texts.push_back(QuestItemText(str, QUEST_TEXT)); + quest->texts.push_back(QuestItemText(str, QuestType::TEXT)); else if (xmlNameEqual(dataNode, "name")) - quest->texts.push_back(QuestItemText(str, QUEST_NAME)); + quest->texts.push_back(QuestItemText(str, QuestType::NAME)); else if (xmlNameEqual(dataNode, "reward")) - quest->texts.push_back(QuestItemText(str, QUEST_REWARD)); + quest->texts.push_back(QuestItemText(str, QuestType::REWARD)); } mQuests[var].push_back(quest); } @@ -406,12 +400,12 @@ void QuestsWindow::showQuest(const QuestItem *const quest) const QuestItemText &data = *it; switch (data.type) { - case QUEST_TEXT: - case QUEST_REWARD: + case QuestType::TEXT: + case QuestType::REWARD: default: mText->addRow(translator->getStr(data.text)); break; - case QUEST_NAME: + case QuestType::NAME: mText->addRow(std::string("[").append(translator->getStr( data.text)).append("]")); break; diff --git a/src/resources/questtype.h b/src/resources/questtype.h new file mode 100644 index 000000000..9a0805a79 --- /dev/null +++ b/src/resources/questtype.h @@ -0,0 +1,34 @@ +/* + * The ManaPlus Client + * Copyright (C) 2012-2014 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef RESOURCES_QUESTTYPE_H +#define RESOURCES_QUESTTYPE_H + +namespace QuestType +{ + enum Type + { + TEXT = 0, + NAME = 1, + REWARD = 2 + }; +} + +#endif // RESOURCES_QUESTTYPE_H |