00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifdef __cplusplus
00024
00025 # ifndef OGS_CORE_BODY_PART_H
00026 # define OGS_CORE_BODY_PART_H
00027
00028 # include <cassert>
00029
00030 # include <ogs/support/Object.h>
00031 # include <ogs/core/Namespace.h>
00032 # include <ogs/core/Types.h>
00033
00034 OGS_BEGIN_CORE_NAMESPACE
00035
00036 class Creature;
00037 class Item;
00038
00048 class BodyPart: public ogs::support::Object {
00049 public:
00058 enum Type {
00059 HEAD = 1,
00060 EYES,
00061 LEFT_EYE,
00062 RIGHT_EYE,
00063 NECK,
00064 TORSO,
00065 BACK,
00066 ARMS,
00067 LEFT_ARM,
00068 RIGHT_ARM,
00069 HANDS,
00070 LEFT_HAND,
00071 RIGHT_HAND,
00072 WAIST,
00073 LEGS,
00074 LEFT_LEG,
00075 RIGHT_LEG,
00076 LEFT_FOOT,
00077 RIGHT_FOOT,
00078 };
00079
00084 typedef std::list<ItemPtr> Items;
00085
00086 BodyPart (Creature& creature, Type type);
00087
00088 Creature& getCreature () const;
00089 Type getType () const;
00090 Items getItems () const;
00091 bool equipItem (Item& item);
00092 bool unequipItem (Item& item);
00093
00094 private:
00095 Creature* _creature;
00096 Type _type;
00097 Items _items;
00098 };
00099
00107 inline BodyPart::BodyPart (Creature& creature, Type type):
00108 _creature (&creature),
00109 _type (type),
00110 _items () {
00111
00112 }
00113
00119 inline Creature&
00120 BodyPart::getCreature () const {
00121 assert (this->_creature != NULL);
00122 return (*(this->_creature));
00123 }
00124
00130 inline BodyPart::Type
00131 BodyPart::getType () const {
00132 return (this->_type);
00133 }
00134
00140 inline BodyPart::Items
00141 BodyPart::getItems () const {
00142 return (this->_items);
00143 }
00144
00145 OGS_END_CORE_NAMESPACE
00146
00147 # endif
00148
00149 #endif
00150