summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-20 19:47:54 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-20 19:47:54 +0300
commit8167471e438210f4a81fca8d2c70f52bb736983f (patch)
tree015cadacb4033d508dd8c67ffa2b79b46225d46d /src
parent3252fd4454419f7576390dea6157897218a503d6 (diff)
downloadmanaplus-8167471e438210f4a81fca8d2c70f52bb736983f.tar.gz
manaplus-8167471e438210f4a81fca8d2c70f52bb736983f.tar.bz2
manaplus-8167471e438210f4a81fca8d2c70f52bb736983f.tar.xz
manaplus-8167471e438210f4a81fca8d2c70f52bb736983f.zip
Move itemcolordata into separate file.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am1
-rw-r--r--src/resources/beinginfo.cpp2
-rw-r--r--src/resources/beinginfo.h7
-rw-r--r--src/resources/db/colordb.cpp2
-rw-r--r--src/resources/db/colordb.h29
-rw-r--r--src/resources/itemcolordata.h56
-rw-r--r--src/resources/iteminfo.cpp14
-rw-r--r--src/resources/iteminfo.h10
9 files changed, 75 insertions, 48 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e03348ed3..cd48f24cb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -675,6 +675,7 @@ SET(SRCS
resources/imageset.cpp
resources/imagewriter.cpp
resources/imagewriter.h
+ resources/itemcolordata.h
resources/db/itemdb.cpp
resources/db/itemdb.h
resources/basicstat.h
@@ -1736,6 +1737,7 @@ SET(DYE_CMD_SRCS
resources/imageset.h
resources/imagewriter.cpp
resources/imagewriter.h
+ resources/itemcolordata.h
resources/resource.cpp
resources/resource.h
resources/resourcefunctiontypes.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 49f46db70..0b5a34bd8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -443,6 +443,7 @@ BASE_SRC += events/actionevent.h \
resources/imageset.h \
resources/imagewriter.cpp \
resources/imagewriter.h \
+ resources/itemcolordata.h \
resources/mstack.h \
resources/notificationinfo.h \
resources/notifications.h \
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index e4fe5c851..5c10d5ae3 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -227,7 +227,7 @@ std::string BeingInfo::getColor(const ItemColor idx) const
if (mColors == nullptr)
return std::string();
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mColors->find(idx);
if (it == mColors->end())
return std::string();
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index 6b359cec1..531392e99 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -38,10 +38,7 @@
struct Attack;
-namespace ColorDB
-{
- class ItemColorData;
-} // namespace ColorDB
+class ItemColorData;
typedef std::map<int, Attack*> Attacks;
@@ -361,7 +358,7 @@ class BeingInfo final
std::string mCurrency;
unsigned char mBlockWalkMask;
BlockTypeT mBlockType;
- const std::map <ItemColor, ColorDB::ItemColorData> *mColors;
+ const std::map <ItemColor, ItemColorData> *mColors;
int mTargetOffsetX;
int mTargetOffsetY;
int mNameOffsetX;
diff --git a/src/resources/db/colordb.cpp b/src/resources/db/colordb.cpp
index 088bb8832..f4cd0921b 100644
--- a/src/resources/db/colordb.cpp
+++ b/src/resources/db/colordb.cpp
@@ -214,7 +214,7 @@ int ColorDB::getHairSize()
return mHairColorsSize;
}
-const std::map <ItemColor, ColorDB::ItemColorData>
+const std::map <ItemColor, ItemColorData>
*ColorDB::getColorsList(const std::string &name)
{
const ColorListsIterator it = mColorLists.find(name);
diff --git a/src/resources/db/colordb.h b/src/resources/db/colordb.h
index d4e0ecb29..5189d7c85 100644
--- a/src/resources/db/colordb.h
+++ b/src/resources/db/colordb.h
@@ -22,11 +22,11 @@
#ifndef RESOURCES_DB_COLORDB_H
#define RESOURCES_DB_COLORDB_H
-#include "enums/simpletypes/itemcolor.h"
#include "enums/simpletypes/skiperror.h"
+#include "resources/itemcolordata.h"
+
#include <map>
-#include <string>
#include "localconsts.h"
@@ -35,31 +35,6 @@
*/
namespace ColorDB
{
- class ItemColorData final
- {
- public:
- ItemColorData() :
- id(ItemColor_zero),
- name(),
- color()
- { }
-
- ItemColorData(const ItemColor id0,
- const std::string &name0,
- const std::string &color0) :
- id(id0),
- name(name0),
- color(color0)
- {
- }
-
- A_DEFAULT_COPY(ItemColorData)
-
- ItemColor id;
- std::string name;
- std::string color;
- };
-
/**
* Loads the color data from <code>colors.xml</code>.
*/
diff --git a/src/resources/itemcolordata.h b/src/resources/itemcolordata.h
new file mode 100644
index 000000000..60eb247ff
--- /dev/null
+++ b/src/resources/itemcolordata.h
@@ -0,0 +1,56 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2008 Aethyra Development Team
+ * Copyright (C) 2011-2017 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_ITEMCOLORDATA_H
+#define RESOURCES_ITEMCOLORDATA_H
+
+#include "enums/simpletypes/itemcolor.h"
+
+#include <string>
+
+#include "localconsts.h"
+
+class ItemColorData final
+{
+ public:
+ ItemColorData() :
+ id(ItemColor_zero),
+ name(),
+ color()
+ { }
+
+ ItemColorData(const ItemColor id0,
+ const std::string &name0,
+ const std::string &color0) :
+ id(id0),
+ name(name0),
+ color(color0)
+ {
+ }
+
+ A_DEFAULT_COPY(ItemColorData)
+
+ ItemColor id;
+ std::string name;
+ std::string color;
+};
+
+#endif // RESOURCES_ITEMCOLORDATA_H
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 7a88a63ca..7218f2cc8 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -227,7 +227,7 @@ std::string ItemInfo::getDyeColorsString(const ItemColor color) const
if ((mColorsList == nullptr) || mColorsListName.empty())
return "";
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mColorsList->find(color);
if (it == mColorsList->end())
return "";
@@ -240,7 +240,7 @@ std::string ItemInfo::getDyeIconColorsString(const ItemColor color) const
if ((mIconColorsList == nullptr) || mIconColorsListName.empty())
return "";
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mIconColorsList->find(color);
if (it == mIconColorsList->end())
return "";
@@ -269,7 +269,7 @@ const std::string ItemInfo::replaceColors(std::string str,
std::string name;
if ((mColorsList != nullptr) && !mColorsListName.empty())
{
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mColorsList->find(color);
if (it == mColorsList->end())
name = "unknown";
@@ -413,7 +413,7 @@ std::string ItemInfo::getColorName(const ItemColor idx) const
if (mColorsList == nullptr)
return std::string();
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mColorsList->find(idx);
if (it == mColorsList->end())
{
@@ -430,7 +430,7 @@ std::string ItemInfo::getColor(const ItemColor idx) const
if (mColorsList == nullptr)
return std::string();
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mColorsList->find(idx);
if (it == mColorsList->end())
{
@@ -447,7 +447,7 @@ std::string ItemInfo::getIconColorName(const ItemColor idx) const
if (mIconColorsList == nullptr)
return std::string();
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mIconColorsList->find(idx);
if (it == mIconColorsList->end())
{
@@ -464,7 +464,7 @@ std::string ItemInfo::getIconColor(const ItemColor idx) const
if (mIconColorsList == nullptr)
return std::string();
- const std::map <ItemColor, ColorDB::ItemColorData>::const_iterator
+ const std::map <ItemColor, ItemColorData>::const_iterator
it = mIconColorsList->find(idx);
if (it == mIconColorsList->end())
{
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 3df93e978..5d06a89e8 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -31,17 +31,13 @@
#include "enums/simpletypes/itemcolor.h"
#include "resources/cursors.h"
+#include "resources/itemcolordata.h"
#include "resources/soundinfo.h"
#include "resources/sprite/spritedisplay.h"
#include "utils/intmap.h"
-namespace ColorDB
-{
- class ItemColorData;
-} // namespace ColorDB
-
// sprite, <itemfrom, itemto>
typedef std::map<int, IntMap> SpriteToItemMap;
typedef SpriteToItemMap::const_iterator SpriteToItemMapCIter;
@@ -364,8 +360,8 @@ class ItemInfo final
/** Stores the names of sounds to be played at certain event. */
std::map <ItemSoundEvent::Type, SoundInfoVect> mSounds;
std::map <int, int> mTags;
- const std::map <ItemColor, ColorDB::ItemColorData> *mColorsList;
- const std::map <ItemColor, ColorDB::ItemColorData> *mIconColorsList;
+ const std::map <ItemColor, ItemColorData> *mColorsList;
+ const std::map <ItemColor, ItemColorData> *mIconColorsList;
std::string mColorsListName;
std::string mIconColorsListName;
ItemColor mCardColor;