clang-format

This commit is contained in:
2026-04-03 10:58:04 +02:00
parent 550a005ca6
commit c25d4dc7e5
50 changed files with 9735 additions and 11503 deletions

View File

@@ -1,40 +1,38 @@
#include "lang.h"
#include <fstream> // for basic_ifstream, basic_istream, ifstream
#include "asset.h" // for Asset
// Constructor
Lang::Lang(Asset *mAsset)
{
Lang::Lang(Asset *mAsset) {
this->mAsset = mAsset;
}
// Destructor
Lang::~Lang()
{
Lang::~Lang() {
}
// Inicializa los textos del juego en el idioma seleccionado
bool Lang::setLang(Uint8 lang)
{
bool Lang::setLang(Uint8 lang) {
std::string file;
switch (lang)
{
case es_ES:
file = mAsset->get("es_ES.txt");
break;
switch (lang) {
case es_ES:
file = mAsset->get("es_ES.txt");
break;
case en_UK:
file = mAsset->get("en_UK.txt");
break;
case en_UK:
file = mAsset->get("en_UK.txt");
break;
case ba_BA:
file = mAsset->get("ba_BA.txt");
break;
case ba_BA:
file = mAsset->get("ba_BA.txt");
break;
default:
file = mAsset->get("en_UK.txt");
break;
default:
file = mAsset->get("en_UK.txt");
break;
}
for (int i = 0; i < MAX_TEXT_STRINGS; i++)
@@ -43,20 +41,17 @@ bool Lang::setLang(Uint8 lang)
bool success = false;
std::ifstream rfile(file);
if (rfile.is_open() && rfile.good())
{
if (rfile.is_open() && rfile.good()) {
success = true;
std::string line;
// lee el resto de datos del fichero
int index = 0;
while (std::getline(rfile, line))
{
while (std::getline(rfile, line)) {
// Almacena solo las lineas que no empiezan por # o no esten vacias
const bool test1 = line.substr(0,1) != "#";
const bool test1 = line.substr(0, 1) != "#";
const bool test2 = !line.empty();
if (test1 && test2)
{
if (test1 && test2) {
mTextStrings[index] = line;
index++;
}
@@ -67,7 +62,6 @@ bool Lang::setLang(Uint8 lang)
}
// Obtiene la cadena de texto del indice
std::string Lang::getText(int index)
{
std::string Lang::getText(int index) {
return mTextStrings[index];
}