Añadida Tu peor pesadilla a la pantalla de Game Over

This commit is contained in:
2022-11-18 16:07:33 +01:00
parent c35be7d21c
commit 2665b93b70
7 changed files with 52 additions and 19 deletions

View File

@@ -16,6 +16,7 @@ Stats::Stats(std::string file, options_t *options)
// Destructor
Stats::~Stats()
{
checkWorstNightmare();
#ifndef DEBUG
saveToFile();
#endif
@@ -135,7 +136,7 @@ bool Stats::loadFromFile()
}
// Carga las estadisticas desde un servidor
bool Stats::loadFromServer()
void Stats::loadFromServer()
{
if (options->online.enabled)
{
@@ -180,4 +181,18 @@ void Stats::saveToServer()
jscore::setUserData(options->online.gameID, options->online.jailerID, data);
}
}
}
// Calcula cual es la habitación con más muertes
void Stats::checkWorstNightmare()
{
int deaths = 0;
for (auto item : list)
{
if (item.died > deaths)
{
deaths = item.died;
options->stats.worstNightmare = item.name;
}
}
}