CommonEntity Class Reference
[Game Data]

Basic game entity representation. More...

#include <commonentity.h>

Inherited by LandscapeEntity, and WorldEntity.

Inheritance diagram for CommonEntity:

Inheritance graph
[legend]
Collaboration diagram for CommonEntity:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CommonEntity ()
virtual ~CommonEntity ()=0
void setID (int ID)
int getID ()
void basicInit (int ID, GLVector3d position, GLQuaterniond orientation)
 Makes basic initialzation of object - fills in ID, position and orientation.
virtual bool init ()
 Makes object-specific initialization.
virtual void destroy ()
 Makes object-specific actions when being removed from world.
virtual void render ()
ClassType getClassType ()
 Returns which descendant of CommonEntity this class is.
void tranformColModel ()
 Applies transformations to collision model.
GLVector3d getPosition ()
 Return position of object.
void setPosition (GLVector3d pos)
 Sets the position of object. BE CAREFULL!
GLQuaterniond getOrientation ()
 Return orientation of object.
void setOrientation (GLQuaterniond orient)
 Sets the orientation of object. BE CAREFULL!

Public Attributes

CollisionModel mColModel
 Represents collision model of this object.

Protected Attributes

GLVector3d mPosition
 Position of an object in the world.
GLQuaterniond mOrientation
 Orientation of object in the world.
int mID
 Unique indetificator of object in all world. Note that valid value is > 0.
ClassType mType
 Determines which class this is.
int mSubType
 Identifies subtype of thi object - eg. which type of tank is this.

Private Member Functions

 CommonEntity (const CommonEntity &)
 Private copy contstruktor - we don't want anybody to copy this.

Detailed Description

Basic game entity representation.

This class is abstract ancestor of all objects in game, as moving as steady ones. It has methods that draws the object, object initialization, collision detection helpers,...

Definition at line 29 of file commonentity.h.


Constructor & Destructor Documentation

CommonEntity::CommonEntity  ) 
 

Definition at line 5 of file commonentity.cpp.

References mID.

CommonEntity::~CommonEntity  )  [pure virtual]
 

Definition at line 10 of file commonentity.cpp.

CommonEntity::CommonEntity const CommonEntity  )  [private]
 

Private copy contstruktor - we don't want anybody to copy this.

Definition at line 59 of file commonentity.cpp.

References DIE().

Here is the call graph for this function:


Member Function Documentation

void CommonEntity::basicInit int  ID,
GLVector3d  position,
GLQuaterniond  orientation
 

Makes basic initialzation of object - fills in ID, position and orientation.

Parameters:
ID ID to set for this object.
position Position of new object in scene.
orientation Orientation of object in scene.

Definition at line 15 of file commonentity.cpp.

References mOrientation, mPosition, and setID().

Referenced by World::createBonusBox().

Here is the call graph for this function:

void CommonEntity::destroy  )  [virtual]
 

Makes object-specific actions when being removed from world.

This method is called from Wrld::delete* methods to allow objects to do their specific cleanup operations, when removed from world. Now this means also object destruction, but this may change in future, so use this method, NOT destructor!

Definition at line 27 of file commonentity.cpp.

ClassType CommonEntity::getClassType  ) 
 

Returns which descendant of CommonEntity this class is.

Returns:
Type of this object.

Definition at line 47 of file commonentity.cpp.

References cInvalid, DIE(), LOGE, and mType.

Referenced by World::deleteBonusBox(), World::deleteProjectile(), and World::deleteTank().

Here is the call graph for this function:

int CommonEntity::getID  ) 
 

Definition at line 42 of file commonentity.cpp.

References mID.

Referenced by World::addWorldEntity(), and World::delWorldEntity().

GLQuaterniond CommonEntity::getOrientation  )  [inline]
 

Return orientation of object.

Returns:
Orientation of object.

Definition at line 116 of file commonentity.h.

References mOrientation.

GLVector3d CommonEntity::getPosition  )  [inline]
 

Return position of object.

Returns:
Position of object.

Definition at line 98 of file commonentity.h.

References mPosition.

Referenced by TaskSimulationServer::checkTerrainHeights().

bool CommonEntity::init  )  [virtual]
 

Makes object-specific initialization.

This method is intended to do stuff like initialization of 3D model... If it returns false, the object won't be added to list of objects and will be deleted. This method should have no paramters. Every inherited class can contain method bool initSpecific(), where can be used specific parameters for initialization.

Returns:
True if init is succesfull, otherwise the object id deleted

Definition at line 22 of file commonentity.cpp.

Referenced by World::createBonusBox().

void CommonEntity::render  )  [virtual]
 

Reimplemented in LandscapeEntity, and Tank.

Definition at line 31 of file commonentity.cpp.

Referenced by LayerGame::renderWorldEntities().

void CommonEntity::setID int  ID  ) 
 

Definition at line 37 of file commonentity.cpp.

References mID.

Referenced by basicInit().

void CommonEntity::setOrientation GLQuaterniond  orient  )  [inline]
 

Sets the orientation of object. BE CAREFULL!

Parameters:
orient New orientation of object.

Definition at line 125 of file commonentity.h.

References mOrientation.

void CommonEntity::setPosition GLVector3d  pos  )  [inline]
 

Sets the position of object. BE CAREFULL!

Parameters:
pos New position of object.

Definition at line 107 of file commonentity.h.

References mPosition.

Referenced by TaskSimulationServer::checkTerrainHeights().

void CommonEntity::tranformColModel  )  [inline]
 

Applies transformations to collision model.

Definition at line 86 of file commonentity.h.

References CollisionModel::finishTransformations(), mColModel, mOrientation, mPosition, CollisionModel::resetTransformations(), CollisionModel::setRotation(), and CollisionModel::setTranslation().

Here is the call graph for this function:


Member Data Documentation

CollisionModel CommonEntity::mColModel
 

Represents collision model of this object.

Definition at line 81 of file commonentity.h.

Referenced by TaskSimulationServer::checkTerrainHeights(), Tank::render(), and tranformColModel().

int CommonEntity::mID [protected]
 

Unique indetificator of object in all world. Note that valid value is > 0.

Definition at line 138 of file commonentity.h.

Referenced by CommonEntity(), WorldEntity::createPresentPoint(), Tank::createPresentPoint(), getID(), and setID().

GLQuaterniond CommonEntity::mOrientation [protected]
 

Orientation of object in the world.

Definition at line 135 of file commonentity.h.

Referenced by basicInit(), WorldEntity::createPresentPoint(), Tank::createPresentPoint(), getOrientation(), Projectile::initByID(), Tank::render(), setOrientation(), and tranformColModel().

GLVector3d CommonEntity::mPosition [protected]
 

Position of an object in the world.

Definition at line 132 of file commonentity.h.

Referenced by basicInit(), WorldEntity::createPresentPoint(), Tank::createPresentPoint(), getPosition(), Tank::render(), setPosition(), and tranformColModel().

int CommonEntity::mSubType [protected]
 

Identifies subtype of thi object - eg. which type of tank is this.

Definition at line 144 of file commonentity.h.

Referenced by Tank::initByID(), and Projectile::initByID().

ClassType CommonEntity::mType [protected]
 

Determines which class this is.

Definition at line 141 of file commonentity.h.

Referenced by BonusBox::BonusBox(), getClassType(), Projectile::Projectile(), and Tank::Tank().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:13:27 2006 for bjs by  doxygen 1.4.5