diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-08-15 13:58:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-08-16 01:52:14 +0300 |
commit | 41cc92f73e39cec5dfea6b1164176610cccc7df4 (patch) | |
tree | 22fd3d388084d2c61fe80f0441c3c30ab8ffd33c /src/resources/db/colordb.h | |
parent | 7aa637abc8b0bca35aacdb9492e65f557ed32038 (diff) | |
download | manaverse-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.gz manaverse-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.bz2 manaverse-41cc92f73e39cec5dfea6b1164176610cccc7df4.tar.xz manaverse-41cc92f73e39cec5dfea6b1164176610cccc7df4.zip |
Add strong typed int for item color.
Diffstat (limited to 'src/resources/db/colordb.h')
-rw-r--r-- | src/resources/db/colordb.h | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/src/resources/db/colordb.h b/src/resources/db/colordb.h index c2923f382..6468b76e3 100644 --- a/src/resources/db/colordb.h +++ b/src/resources/db/colordb.h @@ -22,6 +22,8 @@ #ifndef RESOURCES_DB_COLORDB_H #define RESOURCES_DB_COLORDB_H +#include "enums/simpletypes/itemcolor.h" + #include <map> #include <string> @@ -32,24 +34,25 @@ */ namespace ColorDB { - class ItemColor final + class ItemColorData final { public: - ItemColor() : - id(0), + ItemColorData() : + id(ItemColor_zero), name(), color() { } - ItemColor(const int id0, const std::string &name0, - const std::string &color0) : + ItemColorData(const ItemColor id0, + const std::string &name0, + const std::string &color0) : id(id0), name(name0), color(color0) { } - int id; + ItemColor id; std::string name; std::string color; }; @@ -63,7 +66,7 @@ namespace ColorDB * Loads the color data from <code>colors.xml</code>. */ void loadHair(const std::string &fileName, - std::map<int, ItemColor> &colors); + std::map<ItemColor, ItemColorData> &colors); void loadColorLists(const std::string &fileName); @@ -72,17 +75,19 @@ namespace ColorDB */ void unload(); - std::string &getHairColorName(const int id) A_WARN_UNUSED; + std::string &getHairColorName(const ItemColor id) A_WARN_UNUSED; int getHairSize() A_WARN_UNUSED; - const std::map <int, ItemColor> *getColorsList(const std::string - &name) A_WARN_UNUSED; + const std::map <ItemColor, ItemColorData> *getColorsList(const std::string + &name) + A_WARN_UNUSED; // Color DB - typedef std::map<int, ItemColor> Colors; + typedef std::map<ItemColor, ItemColorData> Colors; typedef Colors::iterator ColorIterator; - typedef std::map <std::string, std::map <int, ItemColor> > ColorLists; + typedef std::map <std::string, std::map <ItemColor, ItemColorData> > + ColorLists; typedef ColorLists::iterator ColorListsIterator; } // namespace ColorDB |