COptions Class Reference

Contains every option in the game and manages the configuration file. More...

#include <COptions.h>

List of all members.

Public Member Functions

 COptions (void)
 Constructor.
 ~COptions (void)
 Destructor. Do nothing.
COptionsoperator= (COptions &Copy)
 Operator = used to copy an option object.
bool Create (bool useAppDataFolder, std::string dynamicDataFolder, std::string pgmFolder)
 Load the options. Create the configuration file if it doesn't exist.
void Destroy (void)
 Free allocated memory.
void SaveBeforeExit (void)
 Write the options to the configuration file.
int GetTimeStartMinutes (void)
 Get how many minutes in the time when a battle starts.
int GetTimeStartSeconds (void)
 Get how many seconds in the time when a battle starts.
int GetTimeUpMinutes (void)
 Get how many minutes in the time when the arena starts closing.
int GetTimeUpSeconds (void)
 Get how many seconds in the time when the arena starts closing.
void SetTimeStart (int TimeStartMinutes, int TimeStartSeconds)
 Set the time when a battle starts.
void SetTimeUp (int TimeUpMinutes, int TimeUpSeconds)
 Set the time when the arena starts closing.
EBomberType GetBomberType (int Player)
 Get the bomber type of the specified player.
void SetBomberType (int Player, EBomberType BomberType)
 Set the bomber type of the specified player.
int GetBattleCount (void)
 Get how many battles to win in order to be victorious.
void SetBattleCount (int BattleCount)
 Set how many battles to win in order to be victorious.
int GetPlayerInput (int Player)
 Get the player input to use for the specified player.
void SetPlayerInput (int Player, int PlayerInput)
 Set the player input to use for the specified player.
void SetDisplayMode (EDisplayMode DisplayMode)
 Set the display mode to use in the CDisplay object.
EDisplayMode GetDisplayMode (void)
 Set the display mode to use in the CDisplay object.
int GetControl (int PlayerInput, int Control)
void SetControl (int PlayerInput, int Control, int Value)
EBlockType GetBlockType (int X, int Y)
int GetNumberOfItemsInWalls (EItemType ItemType)
int GetInitialBomberSkills (EBomberSkills BomberSkill)
void SetLevel (int Level)
int GetLevel (void)
int GetNumberOfLevels (void)
const char * GetLevelName (void)

Private Member Functions

void SetDefaultValues ()
 Set the default configuration values.
void WriteXMLData ()
 Write the options to the XML based configuration file.
void ReadIntFromXML (TiXmlDocument &doc, std::string configNode, std::string attrName, int *value)
 Read an integer from the XML document structure. This function reads an attribute of the node /Bombermaaan/Configuration/NAME, where NAME can be specified by configNode.
bool LoadLevels (std::string appDataFolder, std::string pgmFolder)
 Load game levels data and names from the level directory.
bool LoadConfiguration (void)
 Load the configuration file, create default if it does not exist.
void AllocateLevels (int NumberOfLevels)
 Allocate data and names for the specified number of levels. Warning : does not allocate the names strings (just the array of string pointers).
bool LoadLevel_Version1 (ifstream &File, int CurrentLevel)
 Load level file version 1.
bool LoadLevel_Version2 (std::string fileName, int CurrentLevel, bool requireRemoteFuse=false)
 Load level file version 2 (requiredRemoteFuse = false) or 3 (requiredRemoteFuse = true).
bool CheckMaxNumberOfItems (int Level, unsigned int *sumOfMaxItems)
 Check if number of max items is valid.

Private Attributes

int m_TimeStartMinutes
 How many minutes in the time when a battle starts?
int m_TimeStartSeconds
 How many seconds in the time when a battle starts?
int m_TimeUpMinutes
 How many minutes in the time when the arena starts closing?
int m_TimeUpSeconds
 How many seconds in the time when the arena starts closing?
EBomberType m_BomberType [MAX_PLAYERS]
 Bomber type for each player.
int m_PlayerCount
 Total number of players in the battle.
int m_BattleCount
 How many battles to win in order to be victorious.
int m_PlayerInput [MAX_PLAYERS]
 Player input to use for each player.
EDisplayMode m_DisplayMode
 Current display mode to use in the CDisplay object.
int m_Control [MAX_PLAYER_INPUT][NUM_CONTROLS]
 Control number to use for each player input and for each control.
EBlockType *** m_LevelsData
std::vector< std::string > levelFileNames_short
 A list with file names, one entry for each level (short name withouth path, also see levelFileNames_full).
std::vector< std::string > levelFileNames_full
 A list with file names, one entry for each level (short name withouth path, also see levelFileNames_short).
int m_Level
int m_NumberOfLevels
int ** m_NumberOfItemsInWalls
int ** m_InitialBomberSkills
std::string configFileName
 Full name of the config file (including path).
std::string oldconfigFileName
 Full name of the old (binary) config file (including path).


Detailed Description

Contains every option in the game and manages the configuration file.

Constructor & Destructor Documentation

COptions::COptions ( void   ) 

Constructor.

COptions::~COptions ( void   ) 

Destructor. Do nothing.

Here is the call graph for this function:


Member Function Documentation

void COptions::SetDefaultValues ( void   )  [private]

Set the default configuration values.

Here is the caller graph for this function:

void COptions::WriteXMLData (  )  [private]

Write the options to the XML based configuration file.

The revision number is currently 1

Here is the caller graph for this function:

void COptions::ReadIntFromXML ( TiXmlDocument &  doc,
std::string  configNode,
std::string  attrName,
int *  value 
) [private]

Read an integer from the XML document structure. This function reads an attribute of the node /Bombermaaan/Configuration/NAME, where NAME can be specified by configNode.

Parameters:
doc The TinyXML document
configNode The name of the node below /Bombermaaan/Configuration/
attrName The name of the attribute to be read
value Value of the specified attribute
Todo:
Set first three parameters to const if possible

Here is the caller graph for this function:

bool COptions::LoadLevels ( std::string  appDataFolder,
std::string  pgmFolder 
) [private]

Load game levels data and names from the level directory.

Here is the call graph for this function:

Here is the caller graph for this function:

bool COptions::LoadConfiguration ( void   )  [private]

Load the configuration file, create default if it does not exist.

For migration purposes, the old configuration file is still read. So your settings should be seamlessly migrated to the new XML format. Once the XML file is written, the old configuration file could be deleted.

This feature will be removed in the future.

We always return true since it doesn't matter if the configuration file could not be loaded

Here is the call graph for this function:

Here is the caller graph for this function:

void COptions::AllocateLevels ( int  NumberOfLevels  )  [private]

Allocate data and names for the specified number of levels. Warning : does not allocate the names strings (just the array of string pointers).

Here is the caller graph for this function:

bool COptions::LoadLevel_Version1 ( ifstream &  File,
int  CurrentLevel 
) [private]

Load level file version 1.

Here is the caller graph for this function:

bool COptions::LoadLevel_Version2 ( std::string  fileName,
int  CurrentLevel,
bool  requireRemoteFuse = false 
) [private]

Load level file version 2 (requiredRemoteFuse = false) or 3 (requiredRemoteFuse = true).

Todo:
Replace fix value (third parameter of GetValue(...)) by default setting

Here is the caller graph for this function:

bool COptions::CheckMaxNumberOfItems ( int  Level,
unsigned int *  sumOfMaxItems 
) [private]

Check if number of max items is valid.

check if this level does not exceed the maximum possible number of items

Parameters:
Level the number of the level to check
sumOfMaxItems pointer to an integer variable where the sum of max items is counted
Returns:
true if the number of maximum allowed items is not exceeded, false otherwise

Here is the caller graph for this function:

COptions & COptions::operator= ( COptions Copy  ) 

Operator = used to copy an option object.

Here is the call graph for this function:

bool COptions::Create ( bool  useAppDataFolder,
std::string  dynamicDataFolder,
std::string  pgmFolder 
)

Load the options. Create the configuration file if it doesn't exist.

Here is the call graph for this function:

Here is the caller graph for this function:

void COptions::Destroy ( void   ) 

Free allocated memory.

Here is the caller graph for this function:

void COptions::SaveBeforeExit ( void   ) 

Write the options to the configuration file.

Here is the call graph for this function:

Here is the caller graph for this function:

int COptions::GetTimeStartMinutes ( void   )  [inline]

Get how many minutes in the time when a battle starts.

Here is the caller graph for this function:

int COptions::GetTimeStartSeconds ( void   )  [inline]

Get how many seconds in the time when a battle starts.

Here is the caller graph for this function:

int COptions::GetTimeUpMinutes ( void   )  [inline]

Get how many minutes in the time when the arena starts closing.

Here is the caller graph for this function:

int COptions::GetTimeUpSeconds ( void   )  [inline]

Get how many seconds in the time when the arena starts closing.

Here is the caller graph for this function:

void COptions::SetTimeStart ( int  TimeStartMinutes,
int  TimeStartSeconds 
) [inline]

Set the time when a battle starts.

Here is the caller graph for this function:

void COptions::SetTimeUp ( int  TimeUpMinutes,
int  TimeUpSeconds 
) [inline]

Set the time when the arena starts closing.

Here is the caller graph for this function:

EBomberType COptions::GetBomberType ( int  Player  )  [inline]

Get the bomber type of the specified player.

Here is the caller graph for this function:

void COptions::SetBomberType ( int  Player,
EBomberType  BomberType 
) [inline]

Set the bomber type of the specified player.

Here is the caller graph for this function:

int COptions::GetBattleCount ( void   )  [inline]

Get how many battles to win in order to be victorious.

Here is the caller graph for this function:

void COptions::SetBattleCount ( int  BattleCount  )  [inline]

Set how many battles to win in order to be victorious.

Here is the caller graph for this function:

int COptions::GetPlayerInput ( int  Player  )  [inline]

Get the player input to use for the specified player.

Here is the caller graph for this function:

void COptions::SetPlayerInput ( int  Player,
int  PlayerInput 
) [inline]

Set the player input to use for the specified player.

Here is the caller graph for this function:

void COptions::SetDisplayMode ( EDisplayMode  DisplayMode  )  [inline]

Set the display mode to use in the CDisplay object.

Here is the caller graph for this function:

EDisplayMode COptions::GetDisplayMode ( void   )  [inline]

Set the display mode to use in the CDisplay object.

Here is the caller graph for this function:

int COptions::GetControl ( int  PlayerInput,
int  Control 
) [inline]

Here is the caller graph for this function:

void COptions::SetControl ( int  PlayerInput,
int  Control,
int  Value 
) [inline]

Here is the caller graph for this function:

EBlockType COptions::GetBlockType ( int  X,
int  Y 
) [inline]

Here is the caller graph for this function:

int COptions::GetNumberOfItemsInWalls ( EItemType  ItemType  )  [inline]

Here is the caller graph for this function:

int COptions::GetInitialBomberSkills ( EBomberSkills  BomberSkill  )  [inline]

Here is the caller graph for this function:

void COptions::SetLevel ( int  Level  )  [inline]

Here is the caller graph for this function:

int COptions::GetLevel ( void   )  [inline]

Here is the caller graph for this function:

int COptions::GetNumberOfLevels ( void   )  [inline]

Here is the caller graph for this function:

const char * COptions::GetLevelName ( void   )  [inline]

Here is the caller graph for this function:


Member Data Documentation

How many minutes in the time when a battle starts?

How many seconds in the time when a battle starts?

How many minutes in the time when the arena starts closing?

How many seconds in the time when the arena starts closing?

EBomberType COptions::m_BomberType[MAX_PLAYERS] [private]

Bomber type for each player.

int COptions::m_PlayerCount [private]

Total number of players in the battle.

int COptions::m_BattleCount [private]

How many battles to win in order to be victorious.

int COptions::m_PlayerInput[MAX_PLAYERS] [private]

Player input to use for each player.

Current display mode to use in the CDisplay object.

int COptions::m_Control[MAX_PLAYER_INPUT][NUM_CONTROLS] [private]

Control number to use for each player input and for each control.

std::vector<std::string> COptions::levelFileNames_short [private]

A list with file names, one entry for each level (short name withouth path, also see levelFileNames_full).

std::vector<std::string> COptions::levelFileNames_full [private]

A list with file names, one entry for each level (short name withouth path, also see levelFileNames_short).

int COptions::m_Level [private]

std::string COptions::configFileName [private]

Full name of the config file (including path).

std::string COptions::oldconfigFileName [private]

Full name of the old (binary) config file (including path).


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

Generated on Sat Oct 18 12:26:48 2008 for Bombermaaan by  doxygen 1.5.5
Visit the Bombermaaan project page
SourceForge.net Logo