summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-24 20:42:22 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-24 20:42:22 +0300
commitb7bbb09d62b55bed26d432a6a2af9831c6ec9143 (patch)
tree895bf1e0d842088282f79bbc423ca1f825880254 /src/resources
parent3920b2449e3e55c396b3a5a46f37d965d71de42e (diff)
downloadmanaverse-b7bbb09d62b55bed26d432a6a2af9831c6ec9143.tar.gz
manaverse-b7bbb09d62b55bed26d432a6a2af9831c6ec9143.tar.bz2
manaverse-b7bbb09d62b55bed26d432a6a2af9831c6ec9143.tar.xz
manaverse-b7bbb09d62b55bed26d432a6a2af9831c6ec9143.zip
Change ItemType into strong typed enum.
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/db/itemdb.cpp6
-rw-r--r--src/resources/iteminfo.h6
-rw-r--r--src/resources/itemtypemap.h2
3 files changed, 7 insertions, 7 deletions
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 86a22a8fc..3ef3c8bd4 100644
--- a/src/resources/db/itemdb.cpp
+++ b/src/resources/db/itemdb.cpp
@@ -173,7 +173,7 @@ void ItemDB::setStatsList(const std::vector<ItemDB::Stat> &stats)
extraStats = stats;
}
-static ItemType::Type itemTypeFromString(const std::string &name)
+static ItemTypeT itemTypeFromString(const std::string &name)
{
const size_t sz = sizeof(itemTypeMap) / sizeof(itemTypeMap[0]);
for (size_t f = 0; f < sz; f ++)
@@ -186,7 +186,7 @@ static ItemType::Type itemTypeFromString(const std::string &name)
return ItemType::UNUSABLE;
}
-static std::string useButtonFromItemType(const ItemType::Type &type)
+static std::string useButtonFromItemType(const ItemTypeT &type)
{
const size_t sz = sizeof(itemTypeMap) / sizeof(itemTypeMap[0]);
for (size_t f = 0; f < sz; f ++)
@@ -203,7 +203,7 @@ static std::string useButtonFromItemType(const ItemType::Type &type)
return std::string();
}
-static std::string useButton2FromItemType(const ItemType::Type &type)
+static std::string useButton2FromItemType(const ItemTypeT &type)
{
const size_t sz = sizeof(itemTypeMap) / sizeof(itemTypeMap[0]);
for (size_t f = 0; f < sz; f ++)
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 59b6a0b99..f9c622d3f 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -100,7 +100,7 @@ class ItemInfo final
const std::string &getEffect() const A_WARN_UNUSED
{ return mEffect; }
- void setType(const ItemType::Type type)
+ void setType(const ItemTypeT type)
{ mType = type; }
void setUseButton(const std::string &str)
@@ -115,7 +115,7 @@ class ItemInfo final
const std::string &getUseButton2() const A_WARN_UNUSED
{ return mUseButton2; }
- ItemType::Type getType() const A_WARN_UNUSED
+ ItemTypeT getType() const A_WARN_UNUSED
{ return mType; }
void setWeight(const int weight)
@@ -329,7 +329,7 @@ class ItemInfo final
std::string mEffect; /**< Description of effects. */
std::string mUseButton;
std::string mUseButton2;
- ItemType::Type mType; /**< Item type. */
+ ItemTypeT mType; /**< Item type. */
int mWeight; /**< Weight in grams. */
int mView; /**< Item ID of how this item looks. */
int mId; /**< Item ID */
diff --git a/src/resources/itemtypemap.h b/src/resources/itemtypemap.h
index ccf70068b..6718c8413 100644
--- a/src/resources/itemtypemap.h
+++ b/src/resources/itemtypemap.h
@@ -30,7 +30,7 @@
struct ItemTypeMap final
{
std::string name;
- ItemType::Type type;
+ ItemTypeT type;
std::string useButton;
std::string useButton2;
};