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

TGame Class Reference

Class for game administration. More...

#include <game.h>

Inheritance diagram for TGame:

Inheritance graph
[legend]
Collaboration diagram for TGame:

Collaboration graph
[legend]
List of all members.

Public Methods

void addPlayer (TPlayer *player)
void addRace (TRace *race)
const string & getGameDirectory () const
const string & getGameName () const
const list< TPlayer *> & getPlayers () const
const list< TRace *> & getRaces () const
int4 getTurn () const
virtual void resetAll ()
bool saveServerMasterFile () const
void setGameName (const string &name)
void setTurn (int4 turn)

Protected Types

typedef void(TGame::* tPDBFunc )(TDataPackageList *block)

Protected Methods

 TGame (const string &gameDir, const string &gameName="")
virtual ~TGame ()
string FNamePlayerData (const string &PlayerName) const
string FNamePlayerOrder (const string &PlayerName) const
string FNameServerMaster () const
string FNameUniverseDefinition () const
string FSpecPlayerData (const string &playerName) const
string FSpecPlayerOrder (const string &playerName) const
string FSpecServerMaster () const
string FSpecUniverseDefinition () const
string getBlockType (TDataPackageList *list) const
virtual void PDBAction (TDataPackageList *)
virtual void PDBFleet (TDataPackageList *)
virtual void PDBGalaxy (TDataPackageList *)
virtual void PDBGame (TDataPackageList *)
void PDBItem (TDataPackageList *block)
virtual void PDBLoadOrders (TDataPackageList *)
void PDBPlayer (TDataPackageList *block)
void PDBRace (TDataPackageList *block)
void PDBRuleSystem (TDataPackageList *block)
virtual void PDBSystem (TDataPackageList *)
void processDataBlock (TDataPackageList *block)
void resetLoadLevel ()

Protected Attributes

list< tTransition > fTransitions
TLink< TRacefIluvatar

Private Attributes

int2 fLoadLevel
string fGameDirectory
string fGameName
int4 fCurrentTurn
TPList< TRacefRaces
TPList< TPlayer > fPlayers

Friends

int yyparse ()

Detailed Description

Class for game administration.

Author:
Alberto Barsella <> Marco Krohn <marco.krohn@gmx.de>
Version:
Id:
game.h,v 1.9 2002/05/13 22:58:41 mkrohn5 Exp

This class handles all administration specific things blabla FIXME


Member Typedef Documentation

typedef void(TGame::* TGame::tPDBFunc)(TDataPackageList* block) [protected]
 

Type definition to one of the PDBFunctions.


Constructor & Destructor Documentation

TGame::TGame const string &    gameDir,
const string &    gameName = ""
[protected]
 

Initializes the member variables (e.g. sets fRaces, fPlayers to the autodelete mode to true).

Parameters:
gameDir  The path to the game directory.
gameName  The name of the game.

virtual TGame::~TGame   [protected, virtual]
 

Calls removeAll.


Member Function Documentation

void TGame::addPlayer TPlayer *    player
 

Adds a player to the game. Note that the player is now under control of TGame in the sense that TGame will take care of deleting the object.

Parameters:
player  The player which is added to the game.

void TGame::addRace TRace   race
 

Adds a race to the game. Note that the race is now under control of TGame in the sense that TGame will take care of deleting the object.

Parameters:
player  The rac which is added to the game.

string TGame::FNamePlayerData const string &    PlayerName const [protected]
 

Parameters:
playerName  The name of a player.
Returns:
The filename of the player data file for a specific player.

string TGame::FNamePlayerOrder const string &    PlayerName const [protected]
 

Parameters:
playerName  The name of a player.
Returns:
The filename of the player order file for a specific player.

string TGame::FNameServerMaster   const [protected]
 

Returns:
The filename of the server master file.

string TGame::FNameUniverseDefinition   const [protected]
 

Returns:
The base filename of the universe definition file.

string TGame::FSpecServerMaster   const [protected]
 

Returns:
The complete path (gamedirectory + filename) to the server master file.

string TGame::FSpecUniverseDefinition   const [protected]
 

Returns:
The complete path (gamedirectory + filename) to the universe definition file.

string TGame::getBlockType TDataPackageList   list const [protected]
 

Returns:
Reads and returns the blocktype of the data package list. Note that the data package is extracted during the process. The method will return an empty string if no blocktype was found.

const string& TGame::getGameDirectory   const
 

Returns:
The directory the game data is stored in.

const string& TGame::getGameName   const
 

Returns:
The name of the game.

const list<TPlayer*>& TGame::getPlayers   const
 

Returns:
The list of players in this game.

const list<TRace*>& TGame::getRaces   const
 

Returns:
The list of races in this game.

int4 TGame::getTurn   const
 

Returns:
The current turn we are in.

virtual void TGame::PDBAction TDataPackageList   block [inline, protected, virtual]
 

Only needed as an interface. This method is implemented in TGameCreate.

Reimplemented in TGameSC.

virtual void TGame::PDBFleet TDataPackageList   block [inline, protected, virtual]
 

Only needed as an interface. This method is implemented in TGameCS.

Reimplemented in TGameSC.

virtual void TGame::PDBGalaxy TDataPackageList   block [inline, protected, virtual]
 

Only needed as an interface. This method is implemented in TGameCS.

Reimplemented in TGameSC.

virtual void TGame::PDBGame TDataPackageList   block [inline, protected, virtual]
 

Only needed as an interface. This method is implemented in TGameCS and TGameCreate.

Reimplemented in TGameCreate, and TGameSC.

void TGame::PDBItem TDataPackageList   block [protected]
 

FIXME

virtual void TGame::PDBLoadOrders TDataPackageList   block [inline, protected, virtual]
 

Only needed as an interface. This method is implemented in TGameCS.

Reimplemented in TGameClient, and TGameServer.

void TGame::PDBPlayer TDataPackageList   block [protected]
 

FIXME

void TGame::PDBRace TDataPackageList   block [protected]
 

FIXME

void TGame::PDBRuleSystem TDataPackageList   block [protected]
 

FIXME

virtual void TGame::PDBSystem TDataPackageList   block [inline, protected, virtual]
 

Only needed as an interface. This method is implemented in TGameCS.

Reimplemented in TGameSC.

void TGame::processDataBlock TDataPackageList   block [protected]
 

Processes a list of data packages. This method is called by the parser and the main task of this method is to change the load level and call the right method out of the PDB_XXX set.

Parameters:
block  A block of game data (for more information consult the load-save RFC)

virtual void TGame::resetAll   [virtual]
 

Resets everything (e.g. TUniverse, TLinkUpdate, TRuleSystem ...). Use with care!!!

void TGame::resetLoadLevel   [protected]
 

Resets the variable fLoadLevel to 0.

bool TGame::saveServerMasterFile   const
 

Saves the full game database to disk.

Returns:
true if the data was stored successfully, otherwise false.

void TGame::setGameName const string &    name
 

Sets the name of the game (fGameName).

Parameters:
name  The new name for the game.

void TGame::setTurn int4    turn
 

Sets the current turn.

Parameters:
turn  The current turn.


Friends And Related Function Documentation

int yyparse   [friend]
 

This function invokes the ProcessDataBlock calls.


Member Data Documentation

int4 TGame::fCurrentTurn [private]
 

Current turn being played.

string TGame::fGameDirectory [private]
 

Game directory: all game files reside in this directory and filenames are built with standard names based from this path

string TGame::fGameName [private]
 

The Name of the game.

TLink<TRace> TGame::fIluvatar [protected]
 

The creator and owner of almost everything (planets, systems, ...).

int2 TGame::fLoadLevel [private]
 

This counter is needed to force a certain order during the load process. For instance in the server mode the first thing to read is the rule system.

TPList<TPlayer> TGame::fPlayers [private]
 

Players in the game (may be less than Races - one player may control multiple races). This list is a TPList with autodelete set to true (see TPList::setAutoDeleteMode).

TPList<TRace> TGame::fRaces [private]
 

Races in the game. This list is a TPList with autodelete set to true (see TPList::setAutoDeleteMode).

list<tTransition> TGame::fTransitions [protected]
 

ProcessDataBlock DFA state transition table. This contains some information about the structure of the file which is going to be loaded.


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