Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

BodyPart.h

00001 /*
00002  * BodyPart.h -- class interface for body parts
00003  * Copyright (C) 2003  Eric Lemings <elemings@users.sourceforge.net>
00004  *
00005  * This software is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This software is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this software; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00018  * 02111-1307, USA
00019  *
00020  * RCS: $Id: BodyPart.h,v 1.3 2003/04/18 01:41:02 elemings Exp $
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   // empty constructor body
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 /* !defined OGS_CORE_BODY_PART_H */
00148 
00149 #endif /* defined __cplusplus */
00150 

Generated on Sun Apr 20 03:36:14 2003 for Open Gaming System (OGS) by doxygen1.3