This commit is contained in:
2025-10-27 18:35:53 +01:00
parent b1dca32a5b
commit 3179a08dac
63 changed files with 686 additions and 693 deletions

View File

@@ -1,6 +1,7 @@
#pragma once
#include <string> // Para string
#include <utility>
#include <vector> // Para vector
// Struct para los logros
@@ -20,10 +21,10 @@ struct Achievement {
obtainable(true) {}
// Constructor parametrizado
Achievement(int id, const std::string& caption, const std::string& description, int icon, bool completed = false, bool obtainable = true)
Achievement(int id, std::string caption, std::string description, int icon, bool completed = false, bool obtainable = true)
: id(id),
caption(caption),
description(description),
caption(std::move(caption)),
description(std::move(description)),
icon(icon),
completed(completed),
obtainable(obtainable) {}
@@ -43,7 +44,7 @@ class Cheevos {
void init();
// Busca un logro por id y devuelve el índice
int find(int id);
auto find(int id) -> int;
// Carga el estado de los logros desde un fichero
void loadFromFile();
@@ -52,7 +53,7 @@ class Cheevos {
void saveToFile();
// Constructor
explicit Cheevos(const std::string& file);
explicit Cheevos(std::string file);
// Destructor
~Cheevos();
@@ -65,7 +66,7 @@ class Cheevos {
static void destroy();
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
static Cheevos* get();
static auto get() -> Cheevos*;
// Desbloquea un logro
void unlock(int id);
@@ -80,11 +81,11 @@ class Cheevos {
void enable(bool value) { enabled_ = value; }
// Lista los logros
const std::vector<Achievement>& list() const { return cheevos_list_; }
[[nodiscard]] auto list() const -> const std::vector<Achievement>& { return cheevos_list_; }
// Devuelve el número total de logros desbloqueados
int getTotalUnlockedAchievements();
auto getTotalUnlockedAchievements() -> int;
// Devuelve el número total de logros
int size() { return cheevos_list_.size(); }
auto size() -> int { return cheevos_list_.size(); }
};