From b6e7b6c6cb3ea26157e3a78713cc9621dc46b2d7 Mon Sep 17 00:00:00 2001 From: Philipp Sehmisch Date: Fri, 22 Feb 2008 19:58:29 +0000 Subject: Handling gender with an enum everywhere. (cherry picked from mainline commit d3adc61aa4b4924f82d8cbc23bea26da7257da97) Conflicts: src/net/beinghandler.cpp src/net/charserverhandler.cpp src/player.cpp src/player.h --- src/resources/itemdb.cpp | 8 ++++---- src/resources/iteminfo.cpp | 2 +- src/resources/iteminfo.h | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) (limited to 'src/resources') diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp index f4ccc511..bca2b030 100644 --- a/src/resources/itemdb.cpp +++ b/src/resources/itemdb.cpp @@ -53,8 +53,8 @@ void ItemDB::load() mUnknown = new ItemInfo(); mUnknown->setName("Unknown item"); mUnknown->setImageName(""); - mUnknown->setSprite("error.xml", 0); - mUnknown->setSprite("error.xml", 1); + mUnknown->setSprite("error.xml", GENDER_MALE); + mUnknown->setSprite("error.xml", GENDER_FEMALE); XML::Document doc("items.xml"); xmlNodePtr rootNode = doc.rootNode(); @@ -172,11 +172,11 @@ void loadSpriteRef(ItemInfo *itemInfo, xmlNodePtr node) if (gender == "male" || gender == "unisex") { - itemInfo->setSprite(filename, 0); + itemInfo->setSprite(filename, GENDER_MALE); } if (gender == "female" || gender == "unisex") { - itemInfo->setSprite(filename, 1); + itemInfo->setSprite(filename, GENDER_FEMALE); } } diff --git a/src/resources/iteminfo.cpp b/src/resources/iteminfo.cpp index 5daeafe6..6f669376 100644 --- a/src/resources/iteminfo.cpp +++ b/src/resources/iteminfo.cpp @@ -23,7 +23,7 @@ #include "iteminfo.h" const std::string& -ItemInfo::getSprite(int gender) const +ItemInfo::getSprite(Gender gender) const { if (mView) { diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h index 4678bc08..b7729d2c 100644 --- a/src/resources/iteminfo.h +++ b/src/resources/iteminfo.h @@ -28,6 +28,8 @@ #include "spritedef.h" +#include "../being.h" + enum EquipmentSoundEvent { EQUIP_EVENT_STRIKE, @@ -91,10 +93,10 @@ class ItemInfo void setView(int view) { mView = view; } - void setSprite(const std::string &animationFile, int gender) + void setSprite(const std::string &animationFile, Gender gender) { mAnimationFiles[gender] = animationFile; } - const std::string& getSprite(int gender) const; + const std::string& getSprite(Gender gender) const; void setWeaponType(int); -- cgit v1.2.3-70-g09d2