Loading...
Searching...
No Matches
CPlayerProfile Class Reference

## Public Member Functions

| CPlayerProfile (std::string playerName)
bool | Create ()
bool | Delete ()
std::string | GetName ()
| Returns player name.
std::string | GetSaveDir ()
| Returns player's save directory path.
std::string | GetSaveFile (std::string filename)
| Returns path to file inside player's save directory.
void | IncrementLevelTryCount (LevelCategory cat, int chap, int rank)
| Increments level try count.
int | GetLevelTryCount (LevelCategory cat, int chap, int rank)
| Returns try count for given level.
void | SetLevelPassed (LevelCategory cat, int chap, int rank, bool bPassed)
| Changes level passed status (also updates chapter passed status).
bool | GetLevelPassed (LevelCategory cat, int chap, int rank)
| Chenks if the level (or chapter, if rank=0) is passed.
int | GetChapPassed (LevelCategory cat)
| Returns the highest chapter accessible in the given category.
void | SetSelectedChap (LevelCategory category, int chap)
| Sets selected chapter for save file.
int | GetSelectedChap (LevelCategory category)
| Returns selected chapter from save file.
void | SetSelectedRank (LevelCategory category, int rank)
| Sets selected level for save file.
int | GetSelectedRank (LevelCategory category)
| Returns selected level from save file.
int | GetFreeGameBuildUnlock ()
| Returns unlocked EnableBuild for free game.
void | SetFreeGameBuildUnlock (int freeBuild)
| Saves unlocked EnableBuild for free game.
int | GetFreeGameResearchUnlock ()
| Returns unlocked DoneResearch for free game.
void | SetFreeGameResearchUnlock (int freeResearch)
| Saves unlocked DoneResearch for free game.
PlayerAppearance & | GetAppearance ()
| Returns a reference to PlayerAppearance structure.
void | LoadAppearance ()
| Loads PlayerAppearance structure.
void | SaveAppearance ()
| Saves PlayerAppearance structure.
bool | HasAnySavedScene ()
| Returns true if player has at least one saved scene.
std::vector< SavedScene > | GetSavedSceneList ()
| Returns list of all saved scenes.
void | SaveScene (std::string dir, std::string info)
| Saves current scene status.
void | LoadScene (std::string dir)
| Loads scene.
bool | DeleteScene (std::string dir)
| Delete saved scene.

## Static Public Member Functions

static std::string | GetLastName ()
static std::vector< std::string > | GetPlayerList ()

## Protected Member Functions

void | LoadFinishedLevels (LevelCategory category)
| Loads LevelInfo data for given category.
void | SaveFinishedLevels (LevelCategory category)
| Saves LevelInfo data for given category.
void | LoadFreeGameUnlock ()
| Loads free game unlock state.
void | SaveFreeGameUnlock ()
| Saves free game unlock state.

## Protected Attributes

std::string | m_playerName
| Player name.
std::map< LevelCategory, bool > | m_levelInfoLoaded
| Is finished levels file loaded already?
std::map< LevelCategory, std::map< int, std::map< int, LevelInfo > > > | m_levelInfo
| Level completion info.
std::map< LevelCategory, int > | m_selectChap
| Selected level chapter.
std::map< LevelCategory, int > | m_selectRank
| Selected level rank.
bool | m_freegameLoaded
| Is freegame save file loaded already?
int | m_freegameBuild
| Buildings unlocked for free game.
int | m_freegameResearch
| Researches unlocked for free game.
PlayerAppearance | m_appearance
| Player appearance.

## Member Function Documentation

## GetName()

std::string CPlayerProfile::GetName | ( |  | ) |

Returns player name.

## GetSaveDir()

std::string CPlayerProfile::GetSaveDir | ( |  | ) |

Returns player's save directory path.

## GetSaveFile()

std::string CPlayerProfile::GetSaveFile | ( | std::string | filename | ) |

Returns path to file inside player's save directory.

## IncrementLevelTryCount()

void CPlayerProfile::IncrementLevelTryCount | ( | LevelCategory | cat,
|  | int | chap,
|  | int | rank )

Increments level try count.

## GetLevelTryCount()

int CPlayerProfile::GetLevelTryCount | ( | LevelCategory | cat,
|  | int | chap,
|  | int | rank )

Returns try count for given level.

## SetLevelPassed()

void CPlayerProfile::SetLevelPassed | ( | LevelCategory | cat,
|  | int | chap,
|  | int | rank,
|  | bool | bPassed )

Changes level passed status (also updates chapter passed status).

## GetLevelPassed()

bool CPlayerProfile::GetLevelPassed | ( | LevelCategory | cat,
|  | int | chap,
|  | int | rank )

Chenks if the level (or chapter, if rank=0) is passed.

## GetChapPassed()

int CPlayerProfile::GetChapPassed | ( | LevelCategory | cat | ) |

Returns the highest chapter accessible in the given category.

## SetSelectedChap()

void CPlayerProfile::SetSelectedChap | ( | LevelCategory | category,
|  | int | chap )

Sets selected chapter for save file.

## GetSelectedChap()

int CPlayerProfile::GetSelectedChap | ( | LevelCategory | category | ) |

Returns selected chapter from save file.

## SetSelectedRank()

void CPlayerProfile::SetSelectedRank | ( | LevelCategory | category,
|  | int | rank )

Sets selected level for save file.

## GetSelectedRank()

int CPlayerProfile::GetSelectedRank | ( | LevelCategory | category | ) |

Returns selected level from save file.

## GetFreeGameBuildUnlock()

int CPlayerProfile::GetFreeGameBuildUnlock | ( |  | ) |

Returns unlocked EnableBuild for free game.

## SetFreeGameBuildUnlock()

void CPlayerProfile::SetFreeGameBuildUnlock | ( | int | freeBuild | ) |

Saves unlocked EnableBuild for free game.

## GetFreeGameResearchUnlock()

int CPlayerProfile::GetFreeGameResearchUnlock | ( |  | ) |

Returns unlocked DoneResearch for free game.

## SetFreeGameResearchUnlock()

void CPlayerProfile::SetFreeGameResearchUnlock | ( | int | freeResearch | ) |

Saves unlocked DoneResearch for free game.

## GetAppearance()

PlayerAppearance & CPlayerProfile::GetAppearance | ( |  | ) |

Returns a reference to PlayerAppearance structure.

## LoadAppearance()

void CPlayerProfile::LoadAppearance | ( |  | ) |

Loads PlayerAppearance structure.

## SaveAppearance()

void CPlayerProfile::SaveAppearance | ( |  | ) |

Saves PlayerAppearance structure.

## HasAnySavedScene()

bool CPlayerProfile::HasAnySavedScene | ( |  | ) |

Returns true if player has at least one saved scene.

## GetSavedSceneList()

std::vector< SavedScene > CPlayerProfile::GetSavedSceneList | ( |  | ) |

Returns list of all saved scenes.

## SaveScene()

void CPlayerProfile::SaveScene | ( | std::string | dir,
|  | std::string | info )

Saves current scene status.

## LoadScene()

void CPlayerProfile::LoadScene | ( | std::string | dir | ) |

Loads scene.

## DeleteScene()

bool CPlayerProfile::DeleteScene | ( | std::string | dir | ) |

Delete saved scene.

## LoadFinishedLevels()

void CPlayerProfile::LoadFinishedLevels | ( | LevelCategory | category | ) |

protected

Loads LevelInfo data for given category.

## SaveFinishedLevels()

void CPlayerProfile::SaveFinishedLevels | ( | LevelCategory | category | ) |

protected

Saves LevelInfo data for given category.

## LoadFreeGameUnlock()

void CPlayerProfile::LoadFreeGameUnlock | ( |  | ) |

protected

Loads free game unlock state.

## SaveFreeGameUnlock()

void CPlayerProfile::SaveFreeGameUnlock | ( |  | ) |

protected

Saves free game unlock state.

## Member Data Documentation

## m_playerName

std::string CPlayerProfile::m_playerName

protected

Player name.

## m_levelInfoLoaded

std::map<LevelCategory, bool> CPlayerProfile::m_levelInfoLoaded

protected

Is finished levels file loaded already?

## m_levelInfo

std::map<LevelCategory, std::map<int, std::map<int, LevelInfo> > > CPlayerProfile::m_levelInfo

protected

Level completion info.

## m_selectChap

std::map<LevelCategory, int> CPlayerProfile::m_selectChap

protected

Selected level chapter.

## m_selectRank

std::map<LevelCategory, int> CPlayerProfile::m_selectRank

protected

Selected level rank.

## m_freegameLoaded

bool CPlayerProfile::m_freegameLoaded

protected

Is freegame save file loaded already?

## m_freegameBuild

int CPlayerProfile::m_freegameBuild

protected

Buildings unlocked for free game.

## m_freegameResearch

int CPlayerProfile::m_freegameResearch

protected

Researches unlocked for free game.

## m_appearance

PlayerAppearance CPlayerProfile::m_appearance

protected

Player appearance.

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

- src/level/player_profile.h
- src/level/player_profile.cpp