fix: nom de variable en Locale
This commit is contained in:
@@ -8,23 +8,23 @@
|
|||||||
#include "game/options.hpp" // Para Options::console
|
#include "game/options.hpp" // Para Options::console
|
||||||
|
|
||||||
// [SINGLETON]
|
// [SINGLETON]
|
||||||
Locale* Locale::locale_ = nullptr;
|
Locale* Locale::instance = nullptr;
|
||||||
|
|
||||||
// [SINGLETON] Crea el objeto con esta función estática
|
// [SINGLETON] Crea el objeto con esta función estática
|
||||||
void Locale::init(const std::string& file_path) {
|
void Locale::init(const std::string& file_path) {
|
||||||
Locale::locale_ = new Locale();
|
Locale::instance = new Locale();
|
||||||
Locale::locale_->loadFromFile(file_path);
|
Locale::instance->loadFromFile(file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// [SINGLETON] Destruye el objeto con esta función estática
|
// [SINGLETON] Destruye el objeto con esta función estática
|
||||||
void Locale::destroy() {
|
void Locale::destroy() {
|
||||||
delete Locale::locale_;
|
delete Locale::instance;
|
||||||
Locale::locale_ = nullptr;
|
Locale::instance = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
// [SINGLETON] Con este método obtenemos el objeto y podemos trabajar con él
|
||||||
auto Locale::get() -> Locale* {
|
auto Locale::get() -> Locale* {
|
||||||
return Locale::locale_;
|
return Locale::instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Devuelve la traducción de la clave o la clave como fallback
|
// Devuelve la traducción de la clave o la clave como fallback
|
||||||
|
|||||||
@@ -21,6 +21,6 @@ class Locale {
|
|||||||
void loadFromFile(const std::string& file_path);
|
void loadFromFile(const std::string& file_path);
|
||||||
void flatten(const void* node_ptr, const std::string& prefix); // Aplana nodos YAML anidados
|
void flatten(const void* node_ptr, const std::string& prefix); // Aplana nodos YAML anidados
|
||||||
|
|
||||||
static Locale* locale_;
|
static Locale* instance;
|
||||||
std::unordered_map<std::string, std::string> strings_;
|
std::unordered_map<std::string, std::string> strings_;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user