summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-24 20:51:36 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-24 20:51:36 +0300
commitca0ca278d0c4aed9a6d50bb9a8982f5261151ab8 (patch)
tree47df9210d64faca244f5244088b11cf19da42acf
parentb7bbb09d62b55bed26d432a6a2af9831c6ec9143 (diff)
downloadmv-ca0ca278d0c4aed9a6d50bb9a8982f5261151ab8.tar.gz
mv-ca0ca278d0c4aed9a6d50bb9a8982f5261151ab8.tar.bz2
mv-ca0ca278d0c4aed9a6d50bb9a8982f5261151ab8.tar.xz
mv-ca0ca278d0c4aed9a6d50bb9a8982f5261151ab8.zip
Rename enum ItemType into ItemDbType.
-rw-r--r--src/CMakeLists.txt2
-rw-r--r--src/Makefile.am2
-rw-r--r--src/being/playerinfo.cpp2
-rw-r--r--src/enums/resources/itemdbtype.h (renamed from src/enums/resources/itemtype.h)10
-rw-r--r--src/gui/popups/itempopup.cpp39
-rw-r--r--src/gui/popups/itempopup.h6
-rw-r--r--src/gui/widgets/itemcontainer.cpp4
-rw-r--r--src/gui/windows/buydialog.cpp4
-rw-r--r--src/resources/db/itemdb.cpp42
-rw-r--r--src/resources/iteminfo.cpp2
-rw-r--r--src/resources/iteminfo.h8
-rw-r--r--src/resources/itemtypemap.h4
-rw-r--r--src/resources/itemtypemapdata.h38
13 files changed, 82 insertions, 81 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 92df48845..a93e156fd 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -663,8 +663,8 @@ SET(SRCS
resources/iteminfo.cpp
resources/itemslot.h
enums/resources/imageposition.h
+ enums/resources/itemdbtype.h
enums/resources/itemsoundevent.h
- enums/resources/itemtype.h
resources/itemtypemap.h
resources/itemtypemapdata.h
resources/db/mapdb.cpp
diff --git a/src/Makefile.am b/src/Makefile.am
index 02dae31ce..d1f09f575 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1196,8 +1196,8 @@ manaplus_SOURCES += main.cpp \
resources/iteminfo.cpp \
resources/itemslot.h \
enums/resources/imageposition.h \
+ enums/resources/itemdbtype.h \
enums/resources/itemsoundevent.h \
- enums/resources/itemtype.h \
resources/itemtypemap.h \
resources/itemtypemapdata.h \
resources/mapinfo.h \
diff --git a/src/being/playerinfo.cpp b/src/being/playerinfo.cpp
index dbffe8b3e..04bb267aa 100644
--- a/src/being/playerinfo.cpp
+++ b/src/being/playerinfo.cpp
@@ -31,7 +31,7 @@
#include "being/mercenaryinfo.h"
#include "being/petinfo.h"
-#include "enums/resources/itemtype.h"
+#include "enums/resources/itemdbtype.h"
#endif
#include "gui/windows/inventorywindow.h"
diff --git a/src/enums/resources/itemtype.h b/src/enums/resources/itemdbtype.h
index 29ad14b54..67c634837 100644
--- a/src/enums/resources/itemtype.h
+++ b/src/enums/resources/itemdbtype.h
@@ -20,12 +20,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef RESOURCES_ITEMTYPE_H
-#define RESOURCES_ITEMTYPE_H
+#ifndef RESOURCES_ITEMDBTYPE_H
+#define RESOURCES_ITEMDBTYPE_H
#include "enums/simpletypes/enumdefines.h"
-enumStart(ItemType)
+enumStart(ItemDbType)
{
UNUSABLE = 0,
USABLE,
@@ -45,6 +45,6 @@ enumStart(ItemType)
SPRITE_RACE,
SPRITE_HAIR // 15
}
-enumEnd(ItemType);
+enumEnd(ItemDbType);
-#endif // RESOURCES_ITEMTYPE_H
+#endif // RESOURCES_ITEMDBTYPE_H
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp
index 065704cb8..c1d414539 100644
--- a/src/gui/popups/itempopup.cpp
+++ b/src/gui/popups/itempopup.cpp
@@ -57,7 +57,7 @@ ItemPopup::ItemPopup() :
mItemEffect(new TextBox(this)),
mItemWeight(new TextBox(this)),
mItemCards(new TextBox(this)),
- mItemType(ItemType::UNUSABLE),
+ mItemType(ItemDbType::UNUSABLE),
mIcon(new Icon(this, nullptr)),
mLastName(),
mLastId(0),
@@ -325,29 +325,30 @@ std::string ItemPopup::getCardsString(const int *const cards)
return label->setForegroundColorAll(getThemeColor(name2), \
getThemeColor(name2##_OUTLINE)); \
}
-void ItemPopup::setLabelColor(Label *label, const ItemTypeT type) const
+void ItemPopup::setLabelColor(Label *label,
+ const ItemDbTypeT type) const
{
switch (type)
{
- caseSetColor(ItemType::UNUSABLE, ThemeColorId::GENERIC)
- caseSetColor(ItemType::USABLE, ThemeColorId::USABLE)
- caseSetColor(ItemType::EQUIPMENT_ONE_HAND_WEAPON,
+ caseSetColor(ItemDbType::UNUSABLE, ThemeColorId::GENERIC)
+ caseSetColor(ItemDbType::USABLE, ThemeColorId::USABLE)
+ caseSetColor(ItemDbType::EQUIPMENT_ONE_HAND_WEAPON,
ThemeColorId::ONEHAND)
- caseSetColor(ItemType::EQUIPMENT_TWO_HANDS_WEAPON,
+ caseSetColor(ItemDbType::EQUIPMENT_TWO_HANDS_WEAPON,
ThemeColorId::TWOHAND)
- caseSetColor(ItemType::EQUIPMENT_TORSO, ThemeColorId::TORSO)
- caseSetColor(ItemType::EQUIPMENT_ARMS, ThemeColorId::ARMS)
- caseSetColor(ItemType::EQUIPMENT_HEAD, ThemeColorId::HEAD)
- caseSetColor(ItemType::EQUIPMENT_LEGS, ThemeColorId::LEGS)
- caseSetColor(ItemType::EQUIPMENT_SHIELD, ThemeColorId::SHIELD)
- caseSetColor(ItemType::EQUIPMENT_RING, ThemeColorId::RING)
- caseSetColor(ItemType::EQUIPMENT_NECKLACE, ThemeColorId::NECKLACE)
- caseSetColor(ItemType::EQUIPMENT_FEET, ThemeColorId::FEET)
- caseSetColor(ItemType::EQUIPMENT_AMMO, ThemeColorId::AMMO)
- caseSetColor(ItemType::EQUIPMENT_CHARM, ThemeColorId::CHARM)
- caseSetColor(ItemType::SPRITE_RACE, ThemeColorId::UNKNOWN_ITEM)
- caseSetColor(ItemType::SPRITE_HAIR, ThemeColorId::UNKNOWN_ITEM)
- caseSetColor(ItemType::CARD, ThemeColorId::CARD)
+ caseSetColor(ItemDbType::EQUIPMENT_TORSO, ThemeColorId::TORSO)
+ caseSetColor(ItemDbType::EQUIPMENT_ARMS, ThemeColorId::ARMS)
+ caseSetColor(ItemDbType::EQUIPMENT_HEAD, ThemeColorId::HEAD)
+ caseSetColor(ItemDbType::EQUIPMENT_LEGS, ThemeColorId::LEGS)
+ caseSetColor(ItemDbType::EQUIPMENT_SHIELD, ThemeColorId::SHIELD)
+ caseSetColor(ItemDbType::EQUIPMENT_RING, ThemeColorId::RING)
+ caseSetColor(ItemDbType::EQUIPMENT_NECKLACE, ThemeColorId::NECKLACE)
+ caseSetColor(ItemDbType::EQUIPMENT_FEET, ThemeColorId::FEET)
+ caseSetColor(ItemDbType::EQUIPMENT_AMMO, ThemeColorId::AMMO)
+ caseSetColor(ItemDbType::EQUIPMENT_CHARM, ThemeColorId::CHARM)
+ caseSetColor(ItemDbType::SPRITE_RACE, ThemeColorId::UNKNOWN_ITEM)
+ caseSetColor(ItemDbType::SPRITE_HAIR, ThemeColorId::UNKNOWN_ITEM)
+ caseSetColor(ItemDbType::CARD, ThemeColorId::CARD)
default:
{
return label->setForegroundColorAll(getThemeColor(
diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h
index fc0320614..f862d2754 100644
--- a/src/gui/popups/itempopup.h
+++ b/src/gui/popups/itempopup.h
@@ -24,7 +24,7 @@
#ifndef GUI_POPUPS_ITEMPOPUP_H
#define GUI_POPUPS_ITEMPOPUP_H
-#include "enums/resources/itemtype.h"
+#include "enums/resources/itemdbtype.h"
#include "enums/simpletypes/itemcolor.h"
@@ -82,14 +82,14 @@ class ItemPopup final : public Popup
TextBox *mItemEffect A_NONNULLPOINTER;
TextBox *mItemWeight A_NONNULLPOINTER;
TextBox *mItemCards A_NONNULLPOINTER;
- ItemTypeT mItemType;
+ ItemDbTypeT mItemType;
Icon *mIcon A_NONNULLPOINTER;
std::string mLastName;
int mLastId;
ItemColor mLastColor;
void setLabelColor(Label *label,
- const ItemTypeT type) const A_NONNULL(2);
+ const ItemDbTypeT type) const A_NONNULL(2);
};
extern ItemPopup *itemPopup;
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 96bdb1dcc..f7f7ceb96 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -158,8 +158,8 @@ namespace
const ItemInfo &info1 = pair1->mItem->getInfo();
const ItemInfo &info2 = pair2->mItem->getInfo();
- const ItemTypeT t1 = info1.getType();
- const ItemTypeT t2 = info2.getType();
+ const ItemDbTypeT t1 = info1.getType();
+ const ItemDbTypeT t2 = info2.getType();
if (t1 == t2)
{
return (info1.getName() < info2.getName());
diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp
index c6be959de..b0cf5bc8c 100644
--- a/src/gui/windows/buydialog.cpp
+++ b/src/gui/windows/buydialog.cpp
@@ -160,8 +160,8 @@ namespace
if (!item1 || !item2)
return false;
- const ItemTypeT type1 = item1->getInfo().getType();
- const ItemTypeT type2 = item2->getInfo().getType();
+ const ItemDbTypeT type1 = item1->getInfo().getType();
+ const ItemDbTypeT type2 = item2->getInfo().getType();
if (type1 == type2)
return item1->getPrice() < item2->getPrice();
return type1 < type2;
diff --git a/src/resources/db/itemdb.cpp b/src/resources/db/itemdb.cpp
index 3ef3c8bd4..a860dc8e5 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 ItemTypeT itemTypeFromString(const std::string &name)
+static ItemDbTypeT itemTypeFromString(const std::string &name)
{
const size_t sz = sizeof(itemTypeMap) / sizeof(itemTypeMap[0]);
for (size_t f = 0; f < sz; f ++)
@@ -183,10 +183,10 @@ static ItemTypeT itemTypeFromString(const std::string &name)
return type.type;
}
logger->log("Unknown item type: " + name);
- return ItemType::UNUSABLE;
+ return ItemDbType::UNUSABLE;
}
-static std::string useButtonFromItemType(const ItemTypeT &type)
+static std::string useButtonFromItemType(const ItemDbTypeT &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 ItemTypeT &type)
return std::string();
}
-static std::string useButton2FromItemType(const ItemTypeT &type)
+static std::string useButton2FromItemType(const ItemDbTypeT &type)
{
const size_t sz = sizeof(itemTypeMap) / sizeof(itemTypeMap[0]);
for (size_t f = 0; f < sz; f ++)
@@ -464,28 +464,28 @@ void ItemDB::loadXmlFile(const std::string &fileName, int &tagNum)
switch (itemInfo->getType())
{
- case ItemType::USABLE:
+ case ItemDbType::USABLE:
itemInfo->addTag(mTags["Usable"]);
break;
- case ItemType::CARD:
- case ItemType::UNUSABLE:
+ case ItemDbType::CARD:
+ case ItemDbType::UNUSABLE:
itemInfo->addTag(mTags["Unusable"]);
break;
default:
- case ItemType::EQUIPMENT_ONE_HAND_WEAPON:
- case ItemType::EQUIPMENT_TWO_HANDS_WEAPON:
- case ItemType::EQUIPMENT_TORSO:
- case ItemType::EQUIPMENT_ARMS:
- case ItemType::EQUIPMENT_HEAD:
- case ItemType::EQUIPMENT_LEGS:
- case ItemType::EQUIPMENT_SHIELD:
- case ItemType::EQUIPMENT_RING:
- case ItemType::EQUIPMENT_NECKLACE:
- case ItemType::EQUIPMENT_FEET:
- case ItemType::EQUIPMENT_AMMO:
- case ItemType::EQUIPMENT_CHARM:
- case ItemType::SPRITE_RACE:
- case ItemType::SPRITE_HAIR:
+ case ItemDbType::EQUIPMENT_ONE_HAND_WEAPON:
+ case ItemDbType::EQUIPMENT_TWO_HANDS_WEAPON:
+ case ItemDbType::EQUIPMENT_TORSO:
+ case ItemDbType::EQUIPMENT_ARMS:
+ case ItemDbType::EQUIPMENT_HEAD:
+ case ItemDbType::EQUIPMENT_LEGS:
+ case ItemDbType::EQUIPMENT_SHIELD:
+ case ItemDbType::EQUIPMENT_RING:
+ case ItemDbType::EQUIPMENT_NECKLACE:
+ case ItemDbType::EQUIPMENT_FEET:
+ case ItemDbType::EQUIPMENT_AMMO:
+ case ItemDbType::EQUIPMENT_CHARM:
+ case ItemDbType::SPRITE_RACE:
+ case ItemDbType::SPRITE_HAIR:
itemInfo->addTag(mTags["Equipment"]);
break;
}
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index 79f0e04b5..1de4d9579 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -45,7 +45,7 @@ ItemInfo::ItemInfo() :
mEffect(),
mUseButton(),
mUseButton2(),
- mType(ItemType::UNUSABLE),
+ mType(ItemDbType::UNUSABLE),
mWeight(0),
mView(0),
mId(0),
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index f9c622d3f..ad9a2d6ab 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -25,7 +25,7 @@
#include "enums/being/gender.h"
-#include "enums/resources/itemtype.h"
+#include "enums/resources/itemdbtype.h"
#include "enums/simpletypes/beingtypeid.h"
#include "enums/simpletypes/itemcolor.h"
@@ -100,7 +100,7 @@ class ItemInfo final
const std::string &getEffect() const A_WARN_UNUSED
{ return mEffect; }
- void setType(const ItemTypeT type)
+ void setType(const ItemDbTypeT 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; }
- ItemTypeT getType() const A_WARN_UNUSED
+ ItemDbTypeT 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;
- ItemTypeT mType; /**< Item type. */
+ ItemDbTypeT 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 6718c8413..c2866d430 100644
--- a/src/resources/itemtypemap.h
+++ b/src/resources/itemtypemap.h
@@ -21,7 +21,7 @@
#ifndef RESOURCES_ITEMTYPEMAP_H
#define RESOURCES_ITEMTYPEMAP_H
-#include "enums/resources/itemtype.h"
+#include "enums/resources/itemdbtype.h"
#include <string>
@@ -30,7 +30,7 @@
struct ItemTypeMap final
{
std::string name;
- ItemTypeT type;
+ ItemDbTypeT type;
std::string useButton;
std::string useButton2;
};
diff --git a/src/resources/itemtypemapdata.h b/src/resources/itemtypemapdata.h
index 250bf1835..19f8f658a 100644
--- a/src/resources/itemtypemapdata.h
+++ b/src/resources/itemtypemapdata.h
@@ -29,77 +29,77 @@
ItemTypeMap itemTypeMap[] =
{
- {"generic", ItemType::UNUSABLE,
+ {"generic", ItemDbType::UNUSABLE,
std::string(), std::string()
},
- {"other", ItemType::UNUSABLE,
+ {"other", ItemDbType::UNUSABLE,
// TRANSLATORS: inventory button
N_("Use"), N_("Use")
},
- {"usable", ItemType::USABLE,
+ {"usable", ItemDbType::USABLE,
// TRANSLATORS: inventory button
N_("Use"), N_("Use")
},
- {"equip-1hand", ItemType::EQUIPMENT_ONE_HAND_WEAPON,
+ {"equip-1hand", ItemDbType::EQUIPMENT_ONE_HAND_WEAPON,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-2hand", ItemType::EQUIPMENT_TWO_HANDS_WEAPON,
+ {"equip-2hand", ItemDbType::EQUIPMENT_TWO_HANDS_WEAPON,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-torso", ItemType::EQUIPMENT_TORSO,
+ {"equip-torso", ItemDbType::EQUIPMENT_TORSO,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-arms", ItemType::EQUIPMENT_ARMS,
+ {"equip-arms", ItemDbType::EQUIPMENT_ARMS,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-head", ItemType::EQUIPMENT_HEAD,
+ {"equip-head", ItemDbType::EQUIPMENT_HEAD,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-legs", ItemType::EQUIPMENT_LEGS,
+ {"equip-legs", ItemDbType::EQUIPMENT_LEGS,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-shield", ItemType::EQUIPMENT_SHIELD,
+ {"equip-shield", ItemDbType::EQUIPMENT_SHIELD,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-ring", ItemType::EQUIPMENT_RING,
+ {"equip-ring", ItemDbType::EQUIPMENT_RING,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-charm", ItemType::EQUIPMENT_CHARM,
+ {"equip-charm", ItemDbType::EQUIPMENT_CHARM,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-necklace", ItemType::EQUIPMENT_NECKLACE,
+ {"equip-necklace", ItemDbType::EQUIPMENT_NECKLACE,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-neck", ItemType::EQUIPMENT_NECKLACE,
+ {"equip-neck", ItemDbType::EQUIPMENT_NECKLACE,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-feet", ItemType::EQUIPMENT_FEET,
+ {"equip-feet", ItemDbType::EQUIPMENT_FEET,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"equip-ammo", ItemType::EQUIPMENT_AMMO,
+ {"equip-ammo", ItemDbType::EQUIPMENT_AMMO,
// TRANSLATORS: inventory button
N_("Equip"), N_("Unequip")
},
- {"card", ItemType::CARD,
+ {"card", ItemDbType::CARD,
// TRANSLATORS: inventory button
N_("Insert"), std::string()
},
- {"racesprite", ItemType::SPRITE_RACE,
+ {"racesprite", ItemDbType::SPRITE_RACE,
std::string(), std::string()
},
- {"hairsprite", ItemType::SPRITE_HAIR,
+ {"hairsprite", ItemDbType::SPRITE_HAIR,
std::string(), std::string()
}
};