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

ogs::core::Item Class Reference

An entity that can be utilized or manipulated by a creature. More...

#include <Item.h>

Inheritance diagram for ogs::core::Item:

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

Collaboration graph
[legend]
List of all members.

Public Types

typedef double Worth
 Measures how much the item is worth.

typedef std::string Material
 Material that this item is primarily made of.

typedef unsigned Hardness
 Measures how hard the material is that the item is made of.

typedef double Thickness
 Measures how thick the item is.

typedef Entity::Health Density
 Number of health points per unit of thickness.


Public Member Functions

virtual bool attachObject (Object &object)
 Attach this item to an object.

virtual bool detachObject ()
 Detach this item from an object.

Object * getObject () const
 Determine the object that this item is attached to.

Worth getWorth () const
 Determine the worth of this item.

void setWorth (Worth worth)
 Change the worth of this item.


Protected Member Functions

 Item (Entity::Weight weight=0.0, Size::Type size=Size::MEDIUM, Worth worth=0.0)
 Create a new item.

virtual bool canEquip (const Object &object) const
 Determine if this item can be equipped by an object.


Detailed Description

Items are attachable entities. They can be equipped, worn, held, or contained within other items.


Member Typedef Documentation

typedef Entity::Health ogs::core::Item::Density
 

Density is also used to calculate health of the item.

typedef unsigned ogs::core::Item::Hardness
 

Higher values indicate harder items that are harder to break.

typedef double ogs::core::Item::Thickness
 

Thickness is used to calculate health of the item. Units of measure are locale-dependent.

typedef double ogs::core::Item::Worth
 

Units of measure are locale-dependent.


Member Function Documentation

bool Item::attachObject Object &  object  )  [virtual]
 

This function is called when an item is equipped. If the item cannot be equipped, this function should return false. Derived classes should override this function if the item can affect the object when it is equipped.since it does not allow an item to be equipped by default.

Parameters:
object Object that will equip this item.
Returns:
True if item is equipped.

Implements ogs::support::Attachable.

bool ogs::core::Item::canEquip const Object &  object  )  const [inline, protected, virtual]
 

Derived classes should override this function since it does not allow any item to be equipped.

Parameters:
object Object that will equip item.
Returns:
True if this item can be equipped by an object.

bool ogs::core::Item::detachObject  )  [inline, virtual]
 

This function is called when an item is unequipped. Derived classes should override this function since it always detaches an item from the object that equipped it.

Returns:
True if item is unequipped.

Implements ogs::support::Attachable.

ogs::support::Object * ogs::core::Item::getObject  )  const [inline, virtual]
 

When an item is equipped, it is attached to the object that equipped it. This function will return NULL if the item is not attached to any object.

Returns:
Object that this item is attached to or NULL.

Implements ogs::support::Attachable.

Item::Worth ogs::core::Item::getWorth  )  const [inline]
 

Returns:
Worth of this item.

void Item::setWorth Worth  worth  ) 
 

Observers are notified of this change.

Parameters:
worth Worth of this item.


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