From e2c1b87e38e5c921912b334ca971e92b7989f8a8 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 29 Jun 2016 21:06:30 +0300 Subject: Rename ItemDb::Stat into BasicStat. --- src/CMakeLists.txt | 2 +- src/Makefile.am | 2 +- src/resources/basicstat.h | 42 +++++++++++++++++++++++++++++++++++++++ src/resources/db/itemdb.cpp | 6 +++--- src/resources/db/statdb.cpp | 16 +++++++-------- src/resources/db/statdb.h | 4 ++-- src/resources/itemdbstat.h | 48 --------------------------------------------- 7 files changed, 57 insertions(+), 63 deletions(-) create mode 100644 src/resources/basicstat.h delete mode 100644 src/resources/itemdbstat.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 69de475f3..d6a4a62e3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -660,7 +660,7 @@ SET(SRCS resources/imagewriter.h resources/db/itemdb.cpp resources/db/itemdb.h - resources/itemdbstat.h + resources/basicstat.h resources/db/itemfielddb.cpp resources/db/itemfielddb.h resources/iteminfo.h diff --git a/src/Makefile.am b/src/Makefile.am index d95601ad1..f3beb3f4c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1228,7 +1228,7 @@ manaplus_SOURCES += main.cpp \ resources/db/horsedb.h \ resources/db/itemdb.cpp \ resources/db/itemdb.h \ - resources/itemdbstat.h \ + resources/basicstat.h \ resources/db/itemfielddb.cpp \ resources/db/itemfielddb.h \ resources/db/mapdb.cpp \ diff --git a/src/resources/basicstat.h b/src/resources/basicstat.h new file mode 100644 index 000000000..598e9dc8b --- /dev/null +++ b/src/resources/basicstat.h @@ -0,0 +1,42 @@ +/* + * The ManaPlus Client + * Copyright (C) 2004-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * 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 . + */ + +#ifndef RESOURCES_BASICSTAT_H +#define RESOURCES_BASICSTAT_H + +#include + +#include "localconsts.h" + +struct BasicStat final +{ + BasicStat(const std::string &tag0, + const std::string &format0) : + tag(tag0), + format(format0) + {} + + std::string tag; + std::string format; +}; + +#endif // RESOURCES_BASICSTAT_H diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp index b35290639..4218771d6 100644 --- a/src/resources/db/itemdb.cpp +++ b/src/resources/db/itemdb.cpp @@ -28,7 +28,7 @@ #include "enums/resources/spritedirection.h" -#include "resources/itemdbstat.h" +#include "resources/basicstat.h" #include "resources/iteminfo.h" #include "resources/itemtypemapdata.h" @@ -513,8 +513,8 @@ void ItemDB::loadXmlFile(const std::string &fileName, std::string effect; readFields(effect, node, requiredFields); readFields(effect, node, addFields); - const std::vector &extraStats = StatDb::getExtraStats(); - FOR_EACH (std::vector::const_iterator, it, extraStats) + const std::vector &extraStats = StatDb::getExtraStats(); + FOR_EACH (std::vector::const_iterator, it, extraStats) { std::string value = XML::getProperty( node, it->tag.c_str(), ""); diff --git a/src/resources/db/statdb.cpp b/src/resources/db/statdb.cpp index 41c4b6c44..0d25b07dd 100644 --- a/src/resources/db/statdb.cpp +++ b/src/resources/db/statdb.cpp @@ -36,26 +36,26 @@ namespace { bool mLoaded = false; - static std::vector mBasicStats; + static std::vector mBasicStats; } // namespace void StatDb::addBasicStats() { // TRANSLATORS: player stat - mBasicStats.push_back(ItemDB::Stat("str", _("Strength %s"))); + mBasicStats.push_back(BasicStat("str", _("Strength %s"))); // TRANSLATORS: player stat - mBasicStats.push_back(ItemDB::Stat("agi", _("Agility %s"))); + mBasicStats.push_back(BasicStat("agi", _("Agility %s"))); // TRANSLATORS: player stat - mBasicStats.push_back(ItemDB::Stat("vit", _("Vitality %s"))); + mBasicStats.push_back(BasicStat("vit", _("Vitality %s"))); // TRANSLATORS: player stat - mBasicStats.push_back(ItemDB::Stat("int", _("Intelligence %s"))); + mBasicStats.push_back(BasicStat("int", _("Intelligence %s"))); // TRANSLATORS: player stat - mBasicStats.push_back(ItemDB::Stat("dex", _("Dexterity %s"))); + mBasicStats.push_back(BasicStat("dex", _("Dexterity %s"))); // TRANSLATORS: player stat - mBasicStats.push_back(ItemDB::Stat("luck", _("Luck %s"))); + mBasicStats.push_back(BasicStat("luck", _("Luck %s"))); } -const std::vector &StatDb::getExtraStats() +const std::vector &StatDb::getExtraStats() { return mBasicStats; } diff --git a/src/resources/db/statdb.h b/src/resources/db/statdb.h index 475de6095..5a5d3920a 100644 --- a/src/resources/db/statdb.h +++ b/src/resources/db/statdb.h @@ -23,7 +23,7 @@ #include "enums/simpletypes/skiperror.h" -#include "resources/itemdbstat.h" +#include "resources/basicstat.h" #include #include @@ -41,7 +41,7 @@ namespace StatDb void addBasicStats(); - const std::vector &getExtraStats(); + const std::vector &getExtraStats(); } // namespace StatDb #endif // RESOURCES_DB_STATDB_H diff --git a/src/resources/itemdbstat.h b/src/resources/itemdbstat.h deleted file mode 100644 index 94e12f987..000000000 --- a/src/resources/itemdbstat.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2004-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * 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 . - */ - -#ifndef RESOURCES_DB_ITEMDBSTAT_H -#define RESOURCES_DB_ITEMDBSTAT_H - -#include - -#include "localconsts.h" - -/** - * Item information database. - */ -namespace ItemDB -{ - struct Stat final - { - Stat(const std::string &tag0, - const std::string &format0) : - tag(tag0), - format(format0) - {} - - std::string tag; - std::string format; - }; -} // namespace ItemDB - -#endif // RESOURCES_DB_ITEMDBSTAT_H -- cgit v1.2.3-60-g2f50