From 38e0573a0eed2b7fbf48d6274692f6b0aed6be9a Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Fri, 15 Sep 2023 17:00:32 +0200 Subject: [PATCH] =?UTF-8?q?Fix:=20Guarda=20los=20logros=20tambi=C3=A9n=20c?= =?UTF-8?q?uando=20se=20desbloquean?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/cheevos.cpp | 1 + source/title.cpp | 2 ++ source/title.h | 2 ++ 3 files changed, 5 insertions(+) diff --git a/source/cheevos.cpp b/source/cheevos.cpp index 13105ad..25dc660 100644 --- a/source/cheevos.cpp +++ b/source/cheevos.cpp @@ -138,6 +138,7 @@ void Cheevos::unlock(int id) cheevos[index].completed = true; screen->showNotification("ACHIEVEMENT UNLOCKED!", cheevos[index].caption, cheevos[index].icon); + saveToFile(); } // Invalida un logro diff --git a/source/title.cpp b/source/title.cpp index 3eccd17..8c16893 100644 --- a/source/title.cpp +++ b/source/title.cpp @@ -14,6 +14,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset * // Reserva memoria para los punteros eventHandler = new SDL_Event(); + cheevos = new Cheevos(screen, options, asset->get("cheevos.bin")); if (options->palette == p_zxspectrum) { texture = resource->getTexture("loading_screen_color.png"); @@ -70,6 +71,7 @@ Title::Title(SDL_Renderer *renderer, Screen *screen, Resource *resource, Asset * // Destructor Title::~Title() { + delete cheevos; delete eventHandler; delete sprite; delete pressEnterSprite; diff --git a/source/title.h b/source/title.h index c0a0c49..03f37a7 100644 --- a/source/title.h +++ b/source/title.h @@ -1,6 +1,7 @@ #pragma once #include +#include "cheevos.h" #include "jail_engine/asset.h" #include "jail_engine/input.h" #include "jail_engine/jail_audio.h" @@ -39,6 +40,7 @@ private: options_t *options; // Puntero a las opciones del juego Texture *pressEnterTexture; // Textura con los graficos de PRESS ENTER Sprite *pressEnterSprite; // Sprite para manejar la textura de PRESS ENTER + Cheevos *cheevos; // Objeto encargado de gestionar los logros del juego section_t *section; // Estado del bucle principal para saber si continua o se sale // Variables