diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-03-30 07:19:36 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-03-30 07:19:36 -0600 |
commit | 2bf40f6f1f94cb85d95b8e9ce2942c9d4ce9bd1a (patch) | |
tree | 49fb5a1e363584800f967a4a163fb3e746228722 /src/gui | |
parent | bbf4d657e77fd39887b9941af1fe75a5ec27d988 (diff) | |
download | mana-client-2bf40f6f1f94cb85d95b8e9ce2942c9d4ce9bd1a.tar.gz mana-client-2bf40f6f1f94cb85d95b8e9ce2942c9d4ce9bd1a.tar.bz2 mana-client-2bf40f6f1f94cb85d95b8e9ce2942c9d4ce9bd1a.tar.xz mana-client-2bf40f6f1f94cb85d95b8e9ce2942c9d4ce9bd1a.zip |
Merge item types to remove more #ifdefs
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/itempopup.cpp | 67 | ||||
-rw-r--r-- | src/gui/itempopup.h | 4 | ||||
-rw-r--r-- | src/gui/palette.cpp | 16 | ||||
-rw-r--r-- | src/gui/palette.h | 1 |
4 files changed, 44 insertions, 44 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 66729605..8d51c765 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -112,9 +112,7 @@ void ItemPopup::setItem(const ItemInfo &item) mItemEffect->setTextWrapped(item.getEffect(), 196); mItemWeight->setTextWrapped(_("Weight: ") + Units::formatWeight(item.getWeight()), 196); -#ifdef EATHENA_SUPPORT mItemType = item.getType(); -#endif int minWidth = mItemName->getWidth(); @@ -162,44 +160,43 @@ void ItemPopup::setItem(const ItemInfo &item) void ItemPopup::updateColors() { -#ifdef EATHENA_SUPPORT mItemName->setForegroundColor(getColor(mItemType)); -#endif graphics->setColor(guiPalette->getColor(Palette::TEXT)); } -gcn::Color ItemPopup::getColor(const std::string &type) +gcn::Color ItemPopup::getColor(short type) { - gcn::Color color; - - if (type.compare("generic") == 0) - color = guiPalette->getColor(Palette::GENERIC); - else if (type.compare("equip-head") == 0) - color = guiPalette->getColor(Palette::HEAD); - else if (type.compare("usable") == 0) - color = guiPalette->getColor(Palette::USABLE); - else if (type.compare("equip-torso") == 0) - color = guiPalette->getColor(Palette::TORSO); - else if (type.compare("equip-1hand") == 0) - color = guiPalette->getColor(Palette::ONEHAND); - else if (type.compare("equip-legs") == 0) - color = guiPalette->getColor(Palette::LEGS); - else if (type.compare("equip-feet") == 0) - color = guiPalette->getColor(Palette::FEET); - else if (type.compare("equip-2hand") == 0) - color = guiPalette->getColor(Palette::TWOHAND); - else if (type.compare("equip-shield") == 0) - color = guiPalette->getColor(Palette::SHIELD); - else if (type.compare("equip-ring") == 0) - color = guiPalette->getColor(Palette::RING); - else if (type.compare("equip-arms") == 0) - color = guiPalette->getColor(Palette::ARMS); - else if (type.compare("equip-ammo") == 0) - color = guiPalette->getColor(Palette::AMMO); - else - color = guiPalette->getColor(Palette::UNKNOWN_ITEM); - - return color; + switch (type) + { + case ITEM_UNUSABLE: + return guiPalette->getColor(Palette::GENERIC); + case ITEM_USABLE: + return guiPalette->getColor(Palette::USABLE); + case ITEM_EQUIPMENT_ONE_HAND_WEAPON: + return guiPalette->getColor(Palette::ONEHAND); + case ITEM_EQUIPMENT_TWO_HANDS_WEAPON: + return guiPalette->getColor(Palette::TWOHAND); + case ITEM_EQUIPMENT_TORSO: + return guiPalette->getColor(Palette::TORSO); + case ITEM_EQUIPMENT_ARMS: + return guiPalette->getColor(Palette::ARMS); + case ITEM_EQUIPMENT_HEAD: + return guiPalette->getColor(Palette::HEAD); + case ITEM_EQUIPMENT_LEGS: + return guiPalette->getColor(Palette::LEGS); + case ITEM_EQUIPMENT_SHIELD: + return guiPalette->getColor(Palette::SHIELD); + case ITEM_EQUIPMENT_RING: + return guiPalette->getColor(Palette::RING); + case ITEM_EQUIPMENT_NECKLACE: + return guiPalette->getColor(Palette::NECKLACE); + case ITEM_EQUIPMENT_FEET: + return guiPalette->getColor(Palette::FEET); + case ITEM_EQUIPMENT_AMMO: + return guiPalette->getColor(Palette::AMMO); + default: + return guiPalette->getColor(Palette::UNKNOWN_ITEM); + } } std::string ItemPopup::getItemName() diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 0e386ef7..37f6f81b 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -72,12 +72,12 @@ class ItemPopup : public Popup TextBox *mItemDesc; TextBox *mItemEffect; TextBox *mItemWeight; - std::string mItemType; + short mItemType; ScrollArea *mItemDescScroll; ScrollArea *mItemEffectScroll; ScrollArea *mItemWeightScroll; - static gcn::Color getColor(const std::string &type); + static gcn::Color getColor(short type); }; #endif // ITEMPOPUP_H diff --git a/src/gui/palette.cpp b/src/gui/palette.cpp index b176fcff..f226d512 100644 --- a/src/gui/palette.cpp +++ b/src/gui/palette.cpp @@ -20,16 +20,17 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include <math.h> - #include "palette.h" -#include "gui.h" -#include "../configuration.h" -#include "../game.h" +#include "configuration.h" +#include "game.h" + +#include "gui/gui.h" -#include "../utils/gettext.h" -#include "../utils/stringutils.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + +#include <math.h> const gcn::Color Palette::BLACK = gcn::Color(0, 0, 0); @@ -119,6 +120,7 @@ Palette::Palette() : addColor(TWOHAND, 0xf46d0e, STATIC, indent + _("2 Handed Weapons")); addColor(SHIELD, 0x9c2424, STATIC, indent + _("Shield")); addColor(RING, 0x0000ff, STATIC, indent + _("Ring")); + addColor(NECKLACE, 0xff00ff, STATIC, indent + _("Necklace")); addColor(ARMS, 0x9c24e8, STATIC, indent + _("Arms")); addColor(AMMO, 0x8b6311, STATIC, indent + _("Ammo")); diff --git a/src/gui/palette.h b/src/gui/palette.h index b2994351..47863cb0 100644 --- a/src/gui/palette.h +++ b/src/gui/palette.h @@ -84,6 +84,7 @@ class Palette : public gcn::ListModel ENTRY(TWOHAND)\ ENTRY(SHIELD)\ ENTRY(RING)\ + ENTRY(NECKLACE)\ ENTRY(ARMS)\ ENTRY(AMMO)\ ENTRY(PARTICLE)\ |