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

Entity.h

00001 /*
00002  * Entity.h -- class interface for entities
00003  * Copyright (C) 2002  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: Entity.h,v 1.8 2003/04/18 01:41:02 elemings Exp $
00021  */
00022 
00023 #ifdef __cplusplus
00024 
00025 #  ifndef OGS_CORE_ENTITY_H
00026 #    define OGS_CORE_ENTITY_H
00027 
00028 #    include <list>
00029 #    include <utility>
00030 
00031 #    include <ogs/support/Object.h>
00032 #    include <ogs/core/Defense.h>
00033 #    include <ogs/core/Namespace.h>
00034 #    include <ogs/core/Size.h>
00035 #    include <ogs/core/Types.h>
00036 
00037 OGS_BEGIN_CORE_NAMESPACE
00038 
00044 class Entity: public ogs::support::Object {
00045   public:
00050     typedef double Weight;
00051 
00061     typedef std::pair<int, int> Health;
00062 
00063     const Size& getSize () const;
00064     Size& getSize ();
00065 
00066     Weight getWeight () const;
00067     void setWeight (Weight weight);
00068 
00069     const Defense& getDefense () const;
00070     Defense& getDefense ();
00071 
00072     Health getHealth () const;
00073     void setHealth (Health health);
00074 
00075     Features getFeatures () const;
00076     bool addFeature (Feature& feature);
00077     bool removeFeature (Feature& feature);
00078 
00079     virtual ~Entity () = 0;
00080 
00081   protected:
00082     Entity (Size::Type size = Size::MEDIUM, Weight weight = 0.0);
00083 
00084   private:
00085     Size _size;
00086     Weight _weight;
00087     Defense _defense;
00088     Health _health;
00089     Features _features;
00090 };
00091 
00097 inline const Size&
00098 Entity::getSize () const {
00099   return (this->_size);
00100 }
00101 
00108 inline Size&
00109 Entity::getSize () {
00110   return (this->_size);
00111 }
00112 
00119 inline Entity::Weight
00120 Entity::getWeight () const {
00121   return (this->_weight);
00122 }
00123 
00129 inline const Defense&
00130 Entity::getDefense () const {
00131   return (this->_defense);
00132 }
00133 
00141 inline Defense&
00142 Entity::getDefense () {
00143   return (this->_defense);
00144 }
00145 
00151 inline Entity::Health
00152 Entity::getHealth () const {
00153   return (this->_health);
00154 }
00155 
00161 inline Features
00162 Entity::getFeatures () const {
00163   return (this->_features);
00164 }
00165 
00166 inline Entity::~Entity () { }
00167 
00168 OGS_END_CORE_NAMESPACE
00169 
00170 #  endif /* !defined OGS_CORE_ENTITY_H */
00171 
00172 #endif /* defined __cplusplus */
00173 

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