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

ogs::core::Entity Class Reference

An object in the game world. More...

#include <Entity.h>

Inheritance diagram for ogs::core::Entity:

Inheritance graph
[legend]
Collaboration diagram for ogs::core::Entity:

Collaboration graph
[legend]
List of all members.

Public Types

typedef double Weight
 A floating point type that measures the weight of entity.

typedef std::pair< int, int > Health
 A pair of signed integer types that measures the health or condition of entity.


Public Member Functions

const SizegetSize () const
 Determine the current size category of this entity.

SizegetSize ()
 Determine the current size category of this entity.

Weight getWeight () const
 Determine the current weight of this entity.

void setWeight (Weight weight)
 Change the weight of this entity.

const DefensegetDefense () const
 Determine the current defense rating of this entity.

DefensegetDefense ()
 Determine the current defense rating of this entity.

Health getHealth () const
 Determine the health of this entity.

void setHealth (Health health)
 Change the health of this entity.

Features getFeatures () const
 Determine the features attached to this entity.

bool addFeature (Feature &feature)
 Add a feature to this entity.

bool removeFeature (Feature &feature)
 Remove a feature from this entity.


Protected Member Functions

 Entity (Size::Type size=Size::MEDIUM, Weight weight=0.0)
 Create a new entity.


Detailed Description

Entities are typically living creatures or nonliving items. The Entity class is an abstract class that contains attributes and operations common to all entities.


Member Typedef Documentation

typedef std::pair<int, int> ogs::core::Entity::Health
 

The first element in the pair is the current health of the entity. The second element is the maximum health. When the current health is equal to the maximum health, the entity is in its best possible condition. A current health value near 0 usually means the entity is nearly destroyed. Health is also referred to as hit points.

typedef double ogs::core::Entity::Weight
 

The units of measurement for weight are locale dependent.


Constructor & Destructor Documentation

Entity::Entity Size::Type  size = Size::MEDIUM,
Weight  weight = 0.0
[protected]
 

This constructor is protected so only derived classes can call it. It initializes weight and health attributes to zero (0), size to medium, defense to base (10), with no features. The size modifier is automatically added to defense. So any change in size will automatically be reflected in the defense.

Parameters:
size Size of entity.
weight Weight of entity.


Member Function Documentation

bool Entity::addFeature Feature feature  ) 
 

If the feature is already in the list of features for this entity or the feature cannot be attached to this entity, this function does nothing.

Parameters:
feature A feature to add to this enitty.
Returns:
True if feature is added to this entity.

Defense & ogs::core::Entity::getDefense  )  [inline]
 

This function allows the caller to add and remove modifiers to the defense rating for this entity.

Returns:
Current defense rating of this entity.

const Defense & ogs::core::Entity::getDefense  )  const [inline]
 

Returns:
Current defense rating of this entity.

Features ogs::core::Entity::getFeatures  )  const [inline]
 

Returns:
A list of features attached to this entity.

Entity::Health ogs::core::Entity::getHealth  )  const [inline]
 

Returns:
Current health of this entity.

Size & ogs::core::Entity::getSize  )  [inline]
 

This function allows the caller to change the size of this entity.

Returns:
Current size of this entity.

const Size & ogs::core::Entity::getSize  )  const [inline]
 

Returns:
Current size of this entity.

Entity::Weight ogs::core::Entity::getWeight  )  const [inline]
 

Units of measurement for weight are locale dependent.

Returns:
Current weight of this entity.

bool Entity::removeFeature Feature feature  ) 
 

If the feature cannot be removed from this entity, this function does nothing.

Parameters:
feature A feature to remove from this enitty.
Returns:
True if feature is removed from this entity.

void Entity::setHealth Health  health  ) 
 

Observers are notified of this change.

Parameters:
health Health of this entity.

void Entity::setWeight Weight  weight  ) 
 

Units of measurement for weight are locale dependent. Observers are notified of the change.

Parameters:
weight Weight of entity.


The documentation for this class was generated from the following files:
Generated on Sun Apr 20 03:38:08 2003 for Open Gaming System (OGS) by doxygen1.3