diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-12-13 22:41:57 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-12-13 23:52:39 +0300 |
commit | 12429b0c526195fca2f9e99e49f94821271b76e8 (patch) | |
tree | 1bf8345c791f80170de13dce82c40f727da1c9de /src | |
parent | f5c40ef7c84f9d5914550b5781bad01ba63676dd (diff) | |
download | plus-12429b0c526195fca2f9e99e49f94821271b76e8.tar.gz plus-12429b0c526195fca2f9e99e49f94821271b76e8.tar.bz2 plus-12429b0c526195fca2f9e99e49f94821271b76e8.tar.xz plus-12429b0c526195fca2f9e99e49f94821271b76e8.zip |
Add support for possible new skill set types.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/enums/resources/skill/skillsettype.h | 33 | ||||
-rw-r--r-- | src/gui/windows/skilldialog.cpp | 49 |
4 files changed, 70 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f7b7282f4..f292fb900 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -787,6 +787,7 @@ SET(SRCS const/net/skill.h const/resources/skill.h enums/resources/skill/skillowner.h + enums/resources/skill/skillsettype.h enums/resources/skill/skilltype.h enums/resources/skill/skilltype2.h resources/db/sounddb.cpp diff --git a/src/Makefile.am b/src/Makefile.am index ffb0a7459..fdf0792d2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -450,6 +450,7 @@ SRC += events/actionevent.h \ const/net/skill.h \ const/resources/skill.h \ enums/resources/skill/skillowner.h \ + enums/resources/skill/skillsettype.h \ enums/resources/skill/skilltype.h \ enums/resources/skill/skilltype2.h \ resources/soundeffect.cpp \ diff --git a/src/enums/resources/skill/skillsettype.h b/src/enums/resources/skill/skillsettype.h new file mode 100644 index 000000000..3ef9010a7 --- /dev/null +++ b/src/enums/resources/skill/skillsettype.h @@ -0,0 +1,33 @@ +/* + * The ManaPlus Client + * Copyright (C) 2011-2016 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 ENUMS_RESOURCES_SKILL_SKILLSETTYPE_H +#define ENUMS_RESOURCES_SKILL_SKILLSETTYPE_H + +#include "enums/simpletypes/enumdefines.h" + +enumStart(SkillSetType) +{ + VerticalList = 0, + Rectangle = 1 +} +enumEnd(SkillSetType); + +#endif // ENUMS_RESOURCES_SKILL_SKILLSETTYPE_H diff --git a/src/gui/windows/skilldialog.cpp b/src/gui/windows/skilldialog.cpp index 7e474a982..cfcf60b1b 100644 --- a/src/gui/windows/skilldialog.cpp +++ b/src/gui/windows/skilldialog.cpp @@ -31,6 +31,8 @@ #include "const/resources/spriteaction.h" +#include "enums/resources/skill/skillsettype.h" + #include "gui/shortcut/itemshortcut.h" #include "gui/windows/setupwindow.h" @@ -318,6 +320,14 @@ void SkillDialog::loadXmlFile(const std::string &fileName, // TRANSLATORS: skills dialog default skill tab strprintf(_("Skill Set %d"), setCount)); + const std::string setTypeStr = XML::getProperty(set, "type", ""); + SkillSetTypeT setType = SkillSetType::VerticalList; + if (setTypeStr == "list" || + setTypeStr == "vertical") + { + setType = SkillSetType::VerticalList; + } + SkillModel *const model = new SkillModel; if (!mDefaultModel) mDefaultModel = model; @@ -340,20 +350,31 @@ void SkillDialog::loadXmlFile(const std::string &fileName, model->updateVisibilities(); - // possible leak listbox, scroll - SkillListBox *const listbox = new SkillListBox(this, model); - listbox->setActionEventId("sel"); - listbox->addActionListener(this); - ScrollArea *const scroll = new ScrollArea(this, - listbox, - Opaque_false); - scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); - scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); - - SkillTab *const tab = new SkillTab(this, setName, listbox); - mDeleteTabs.push_back(tab); - - mTabs->addTab(tab, scroll); + switch (setType) + { + case SkillSetType::VerticalList: + { + // possible leak listbox, scroll + SkillListBox *const listbox = new SkillListBox(this, + model); + listbox->setActionEventId("sel"); + listbox->addActionListener(this); + ScrollArea *const scroll = new ScrollArea(this, + listbox, + Opaque_false); + scroll->setHorizontalScrollPolicy(ScrollArea::SHOW_NEVER); + scroll->setVerticalScrollPolicy(ScrollArea::SHOW_ALWAYS); + SkillTab *const tab = new SkillTab(this, setName, listbox); + mDeleteTabs.push_back(tab); + mTabs->addTab(tab, scroll); + break; + } + case SkillSetType::Rectangle: + default: + reportAlways("Unsupported skillset type: %s", + setTypeStr.c_str()); + break; + } } } } |