#include <COptions.h>
Public Member Functions | |
COptions (void) | |
Constructor. | |
~COptions (void) | |
Destructor. Do nothing. | |
COptions & | operator= (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). |
COptions::COptions | ( | void | ) |
Constructor.
COptions::~COptions | ( | void | ) |
Destructor. Do nothing.
void COptions::SetDefaultValues | ( | void | ) | [private] |
Set the default configuration values.
void COptions::WriteXMLData | ( | ) | [private] |
Write the options to the XML based configuration file.
The revision number is currently 1
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.
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 |
bool COptions::LoadLevels | ( | std::string | appDataFolder, | |
std::string | pgmFolder | |||
) | [private] |
Load game levels data and names from the level directory.
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
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).
bool COptions::LoadLevel_Version1 | ( | ifstream & | File, | |
int | CurrentLevel | |||
) | [private] |
Load level file version 1.
bool COptions::LoadLevel_Version2 | ( | std::string | fileName, | |
int | CurrentLevel, | |||
bool | requireRemoteFuse = false | |||
) | [private] |
Load level file version 2 (requiredRemoteFuse = false) or 3 (requiredRemoteFuse = true).
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
Level | the number of the level to check | |
sumOfMaxItems | pointer to an integer variable where the sum of max items is counted |
Operator = used to copy an option object.
bool COptions::Create | ( | bool | useAppDataFolder, | |
std::string | dynamicDataFolder, | |||
std::string | pgmFolder | |||
) |
Load the options. Create the configuration file if it doesn't exist.
void COptions::Destroy | ( | void | ) |
Free allocated memory.
void COptions::SaveBeforeExit | ( | void | ) |
Write the options to the configuration file.
int COptions::GetTimeStartMinutes | ( | void | ) | [inline] |
Get how many minutes in the time when a battle starts.
int COptions::GetTimeStartSeconds | ( | void | ) | [inline] |
Get how many seconds in the time when a battle starts.
int COptions::GetTimeUpMinutes | ( | void | ) | [inline] |
Get how many minutes in the time when the arena starts closing.
int COptions::GetTimeUpSeconds | ( | void | ) | [inline] |
Get how many seconds in the time when the arena starts closing.
void COptions::SetTimeStart | ( | int | TimeStartMinutes, | |
int | TimeStartSeconds | |||
) | [inline] |
Set the time when a battle starts.
void COptions::SetTimeUp | ( | int | TimeUpMinutes, | |
int | TimeUpSeconds | |||
) | [inline] |
Set the time when the arena starts closing.
EBomberType COptions::GetBomberType | ( | int | Player | ) | [inline] |
Get the bomber type of the specified player.
void COptions::SetBomberType | ( | int | Player, | |
EBomberType | BomberType | |||
) | [inline] |
Set the bomber type of the specified player.
int COptions::GetBattleCount | ( | void | ) | [inline] |
Get how many battles to win in order to be victorious.
void COptions::SetBattleCount | ( | int | BattleCount | ) | [inline] |
Set how many battles to win in order to be victorious.
int COptions::GetPlayerInput | ( | int | Player | ) | [inline] |
Get the player input to use for the specified player.
void COptions::SetPlayerInput | ( | int | Player, | |
int | PlayerInput | |||
) | [inline] |
Set the player input to use for the specified player.
void COptions::SetDisplayMode | ( | EDisplayMode | DisplayMode | ) | [inline] |
EDisplayMode COptions::GetDisplayMode | ( | void | ) | [inline] |
int COptions::GetControl | ( | int | PlayerInput, | |
int | Control | |||
) | [inline] |
void COptions::SetControl | ( | int | PlayerInput, | |
int | Control, | |||
int | Value | |||
) | [inline] |
EBlockType COptions::GetBlockType | ( | int | X, | |
int | Y | |||
) | [inline] |
int COptions::GetNumberOfItemsInWalls | ( | EItemType | ItemType | ) | [inline] |
int COptions::GetInitialBomberSkills | ( | EBomberSkills | BomberSkill | ) | [inline] |
void COptions::SetLevel | ( | int | Level | ) | [inline] |
int COptions::GetLevel | ( | void | ) | [inline] |
int COptions::GetNumberOfLevels | ( | void | ) | [inline] |
const char * COptions::GetLevelName | ( | void | ) | [inline] |
int COptions::m_TimeStartMinutes [private] |
How many minutes in the time when a battle starts?
int COptions::m_TimeStartSeconds [private] |
How many seconds in the time when a battle starts?
int COptions::m_TimeUpMinutes [private] |
How many minutes in the time when the arena starts closing?
int COptions::m_TimeUpSeconds [private] |
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.
EDisplayMode COptions::m_DisplayMode [private] |
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.
EBlockType*** COptions::m_LevelsData [private] |
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] |
int COptions::m_NumberOfLevels [private] |
int** COptions::m_NumberOfItemsInWalls [private] |
int** COptions::m_InitialBomberSkills [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).