Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

TUniverse Class Reference

Contains a list of all galaxies, item lists and other global objects. More...

#include <universe.h>

Inheritance diagram for TUniverse:

Inheritance graph
[legend]
Collaboration diagram for TUniverse:

Collaboration graph
[legend]
List of all members.

Public Methods

virtual ~TUniverse ()
bool addGalaxy (TGalaxy *galaxy)
bool addItem (TItem *item)
const list< TGalaxy *> & getGalaxies () const
const list< TItem *> & getItems () const
virtual void reset ()

Static Public Methods

TUniverse * instance ()

Protected Methods

 TUniverse ()

Private Attributes

list< TGalaxy *> fGalaxies
list< TItem *> fItemList

Static Private Attributes

TUniverse * fInstance

Detailed Description

Contains a list of all galaxies, item lists and other global objects.

Author:
Marco Krohn <marco.krohn@gmx.de>
Version:
Id:
universe.h,v 1.5 2002/05/10 10:39:49 mkrohn5 Exp
See also:
TGalaxy, TItem
Note that this class is a singelton meaning that there is always exactly one instance of this class (see instance).

The universe object contains a list of all galaxies existing in this game. Also it offers a list of items which are available in this universe. All parts e.g. in ship designs (TShipDesign) refer to this list of items.


Constructor & Destructor Documentation

virtual TUniverse::~TUniverse   [virtual]
 

Deletes all children (galaxies, items etc.).

See also:
reset

TUniverse::TUniverse   [protected]
 

Constructor made protected to ensure that the users of this class can only create exactly one instance.

See also:
instance


Member Function Documentation

bool TUniverse::addGalaxy TGalaxy   galaxy
 

Adds a galaxy to the universe. This method checks if the galaxy does already belong to the universe (and will ignore the command in this case). Note that TUniverse takes over control of the object in the sense that is responsible for deleting the memory.

Parameters:
galaxy  The galaxy to add to the universe (only values !=0 are accepted).
Returns:
true if the galaxy was added successfully, otherwise false.

bool TUniverse::addItem TItem   item
 

Adds an item to the list of available items. Note that there is no check against adding an item twice. Also note that TUniverse takes over control of the object in the sense that is responsible for deleting the memory.

Parameters:
item  The new item (only values !=0 are accpeted).
Returns:
true if the item was added successfully, otherwise false.

const list<TGalaxy*>& TUniverse::getGalaxies   const
 

Returns:
List of all galaxies.

const list<TItem*>& TUniverse::getItems   const
 

Returns:
The list of items which are accessible in this universe.

TUniverse* TUniverse::instance   [static]
 

Returns:
The unique instance of TUniverse.

virtual void TUniverse::reset   [virtual]
 

This will reset the whole universe and delete all galaxies and everything else which belongs to the universe (e.g. the list of items). Use with care!!!

Reimplemented from TLinkable.


Member Data Documentation

list<TGalaxy*> TUniverse::fGalaxies [private]
 

all galaxies in this universe

TUniverse* TUniverse::fInstance [static, private]
 

The global (and unique) instance of TUniverse

list<TItem*> TUniverse::fItemList [private]
 

list of allowed items in this universe


The documentation for this class was generated from the following file:
Generated on Thu Jun 20 18:13:37 2002 for Stellar Legacy by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001