se_core::Object Class Reference

Base class for important game entities. More...

#include <Object.hpp>

Inheritance diagram for se_core::Object:

se_core::Action se_core::Ambience se_core::Cutscene se_core::Physics se_core::QuestGoal se_core::Script se_core::Signal se_core::ThingCollide List of all members.

Public Member Functions

 Object (int type, const char *name)
 Construct named Object.
virtual ~Object ()
 Destructor.
int id () const
 Get the Object id of the object.
virtual const char * name () const
 Get the name of the Object.
int type () const
 Get the type of the Object (got_ACTION, got_THING, etc).

Static Public Member Functions

int hash (int type, const char *name)
 Calculate hash (object id) given object type and name.

Static Protected Member Functions

const Object_lookup (int hash)
const Object_lookup (int type, const char *name)

Detailed Description

Base class for important game entities.

All instances of Object must be constant throughout the lifetime of the application.

Base class for game entitites like Action, Physics, Collide, etc, that contain behaviour but no non-const data.

Maintains name, id and type identifiers.

Definition at line 43 of file Object.hpp.


Constructor & Destructor Documentation

se_core::Object::Object int  type,
const char *  name
 

Construct named Object.

Parameters:
type The type of Object (got_ACTION, got_THING, etc)
name The name of the game object

Definition at line 28 of file Object.cpp.

References se_core::ObjectRepository::add(), Assert, and se_core::CompSchema::objectRepository().

se_core::Object::~Object  )  [virtual]
 

Destructor.

Definition at line 36 of file Object.cpp.

References se_core::CompSchema::objectRepository(), and se_core::ObjectRepository::remove().


Member Function Documentation

const Object* se_core::Object::_lookup int  type,
const char *  name
[inline, static, protected]
 

Definition at line 102 of file Object.hpp.

const Object * se_core::Object::_lookup int  hash  )  [static, protected]
 

Definition at line 56 of file Object.cpp.

References se_core::ObjectRepository::get(), and se_core::CompSchema::objectRepository().

Referenced by se_core::Signal::lookup(), se_core::Script::lookup(), se_core::QuestGoal::lookup(), se_core::Cutscene::lookup(), se_core::ThingCollide::lookup(), se_core::Physics::lookup(), se_core::Ambience::lookup(), and se_core::Action::lookup().

int se_core::Object::hash int  type,
const char *  name
[static]
 

Calculate hash (object id) given object type and name.

Definition at line 42 of file Object.cpp.

int se_core::Object::id  )  const [inline]
 

Get the Object id of the object.

Each instance of Object has a unique Object id assigned to it during construction. The id_ is a hash of the name. And will be the same every time the game is run.

Sometimes two different names can give the same hash, and id. When this occurs the name of the object must be changed.

Returns:
The unique Object instance id.

Definition at line 69 of file Object.hpp.

Referenced by se_core::ObjectRepository::add(), se_core::operator<<(), and se_core::ObjectRepository::remove().

virtual const char* se_core::Object::name  )  const [inline, virtual]
 

Get the name of the Object.

Returns:
The name of the Object, or 0 if is not named.

Definition at line 78 of file Object.hpp.

Referenced by se_core::operator<<(), se_core::CutsceneParser::parse(), and se_basic::Say::perform().

int se_core::Object::type  )  const [inline]
 

Get the type of the Object (got_ACTION, got_THING, etc).

Classes subclassing game objects should have a type enumerated in the enum ObjectType. The subclass is itself responsible for reporting the type during construction, and a whole subclass hierarchy may share the same type (like Action and its subclasses, Script and its subclasses, etc).

Returns:
The type of the game object.

Definition at line 91 of file Object.hpp.

Referenced by se_core::operator<<().


The documentation for this class was generated from the following files:

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:23 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo