Trabajando en las estadisticas online

This commit is contained in:
2022-11-18 20:06:07 +01:00
parent 2665b93b70
commit fd0bebf533
6 changed files with 158 additions and 24 deletions

View File

@@ -41,7 +41,6 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
music = JA_LoadMusic(asset->get("game.ogg").c_str());
deathSound = JA_LoadSound(asset->get("death.wav").c_str());
stats = new Stats(asset->get("stats.csv"), options);
stats->addVisit(room->getName());
// Inicializa el resto de variables
ticks = 0;
@@ -57,6 +56,8 @@ Game::Game(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset *as
blackScreen = false;
blackScreenCounter = 0;
totalItems = getTotalItems();
initStats();
stats->addVisit(room->getName());
section.name = SECTION_PROG_GAME;
section.subsection = 0;
@@ -619,4 +620,16 @@ void Game::checkRestoringJail()
board.lives++;
JA_PlaySound(deathSound);
}
}
// Inicializa el diccionario de las estadísticas
void Game::initStats()
{
std::vector<res_room_t> *rooms = new std::vector<res_room_t>;
rooms = resource->getAllRooms();
for (auto room : *rooms)
{
stats->addDictionary(room.room->number, room.room->name);
}
}