summaryrefslogtreecommitdiff
path: root/src/resources/iteminfo.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-18 19:00:38 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-18 19:00:38 +0000
commit54ac35bc5a1484757efeae9b342469b9a00fe2a2 (patch)
tree73917e6a43f0a90a9f25aaaad24c214c37bf52c4 /src/resources/iteminfo.cpp
parent03b2efa5973db10c3e6366aa0bd2990eee60d8b9 (diff)
downloadmana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.tar.gz
mana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.tar.bz2
mana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.tar.xz
mana-54ac35bc5a1484757efeae9b342469b9a00fe2a2.zip
Removed player looks from generic beings. Prevented client termination on missing sprites. Merged weapon-type and attack-type fields for items.
Diffstat (limited to 'src/resources/iteminfo.cpp')
-rw-r--r--src/resources/iteminfo.cpp45
1 files changed, 21 insertions, 24 deletions
diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp
index b5b25ac0..6654ccca 100644
--- a/src/resources/iteminfo.cpp
+++ b/src/resources/iteminfo.cpp
@@ -71,32 +71,29 @@ ItemInfo::getSprite(int gender) const
}
}
-void
-ItemInfo::setAttackType(const std::string &attackType)
+void ItemInfo::setWeaponType(int type)
{
- if (attackType == "swing")
- {
- mAttackType = ACTION_ATTACK_SWING;
- }
- else if (attackType == "stab")
- {
- mAttackType = ACTION_ATTACK_STAB;
- }
- else if (attackType == "bow")
- {
- mAttackType = ACTION_ATTACK_BOW;
- }
- else if (attackType == "throw")
- {
- mAttackType = ACTION_ATTACK_THROW;
- }
- else if (attackType == "none")
- {
- mAttackType = ACTION_DEFAULT;
- }
- else
+ // See server item.hpp file for type values.
+ switch (type)
{
- mAttackType = ACTION_ATTACK;
+ case 0: // none
+ mAttackType = ACTION_DEFAULT;
+ break;
+ case 1: // knife
+ case 2: // sword
+ mAttackType = ACTION_ATTACK_STAB;
+ break;
+ case 8: // projectile
+ mAttackType = ACTION_ATTACK_THROW;
+ break;
+ case 10: // bow
+ mAttackType = ACTION_ATTACK_BOW;
+ break;
+ case 11: // sickle
+ mAttackType = ACTION_ATTACK_SWING;
+ break;
+ default:
+ mAttackType = ACTION_ATTACK;
}
}