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

ObjectsPool Class Reference

Container for objects. More...

#include <objectpools.h>

List of all members.

Public Member Functions

void setDefaultObjParam ()
 sets the static default_parameters variable of all objects
const ParameterMap & getDefaultObjParambyName (const string &obj)
 Returns the default_parameters of the corresponding obj or an empty map.
bool empty ()
 Returns true if no objects were loaded so far...
ObjectaddObjectbyName (const string &obj, Sint16 x=0, Sint16 y=0, const ParameterMap &param=ParameterMap(), bool outside=false)
ObjectaddObject (Object *object, bool outside=false)
ObjectgetObject (const string &oname)
string getNextObjectName (const string &basename)
 Helper function to return the next available object name corresponding to the given base name.
PlayerswitchPlayer ()
 Selects a new current player (circular from left to right) if possible.
object_iterator removeObject (object_iterator it)
object_iterator removeObject (Object *object)
ObjectmoveObject (Object *object)

Public Attributes

std::set< Object *, Compare > objectspool
 Object pool.
std::set< Character *, Compare > characterspool
 Character pool.
std::set< Player *, Compare > playerspool
 Player pool.
std::set< Monster *, Compare > monsterspool
 Monster pool.


Detailed Description

Container for objects.

Contains a pool for each important derived object class, manages adding/deleting objects and switching players. Each derived type is contained in all it's super type pools.

Todo:
Move the Object creation code to the objects and remove all dependencies to the objects/ headers.

Cleanup the whole mess.


Member Function Documentation

Object* ObjectsPool::addObjectbyName const string &  obj,
Sint16  x = 0,
Sint16  y = 0,
const ParameterMap &  param = ParameterMap(),
bool  outside = false
 

Todo:
Move this code to the objects Add objects by their names
Add an Object by it's name to the corresponding pool if it was recognized, initialized with the parsed options.
Parameters:
obj Name of the Object class
x x coordinate
y y coordinate
parameters A map<string,string> of all parameters
outside True if the object shouldn't be added to the pools
Returns:
Pointer to the new entry in the objectspool or NULL if the object was not recognized

Object* ObjectsPool::addObject Object object,
bool  outside = false
 

Add an Object to all corresponding pools

Returns:
Pointer to the new entry in the objectspool or NULL if it failed

Object* ObjectsPool::getObject const string &  oname  ) 
 

Gets an object by it's name

Precondition:
The name must be unique (otherwise it's basically random)
Returns:
Pointer to the Object or NULL if it wasn't found

object_iterator ObjectsPool::removeObject object_iterator  it  ) 
 

Remove an Object (using an object_iterator) from all pools it belongs to

Returns:
object_iterator to the next entry in the pool or the end()

object_iterator ObjectsPool::removeObject Object object  ) 
 

Remove an Object (using a pointer to it)

Returns:
object_iterator to the next entry in the pool or the end()

Object* ObjectsPool::moveObject Object object  ) 
 

Detaches an Object from the objectspool

Returns:
Pointer to the detached Object


Member Data Documentation

std::set<Object *,Compare> ObjectsPool::objectspool
 

Object pool.

Contains all objects managed by the ObjectsPool

std::set<Character *,Compare> ObjectsPool::characterspool
 

Character pool.

Contains all characters managed by the ObjectsPool

std::set<Player *,Compare> ObjectsPool::playerspool
 

Player pool.

Contains all players managed by the ObjectsPool

std::set<Monster *,Compare> ObjectsPool::monsterspool
 

Monster pool.

Contains all monsters managed by the ObjectsPool


The documentation for this class was generated from the following file:
Generated on Sun Feb 5 13:02:37 2006 for Lost Penguins by doxygen 1.3.8