This commit is contained in:
2025-10-27 13:01:11 +01:00
parent 5d8811026d
commit cdb9bde6aa
23 changed files with 392 additions and 392 deletions

View File

@@ -385,49 +385,49 @@ void Room::fillMapTexture() {
auto surface = Screen::get()->getRendererSurface();
// BottomSurfaces
if (true) {
{
for (auto l : bottom_floors_) {
surface->drawLine(l.x1, l.y, l.x2, l.y, static_cast<Uint8>(PaletteColor::BLUE));
}
}
// TopSurfaces
if (true) {
{
for (auto l : top_floors_) {
surface->drawLine(l.x1, l.y, l.x2, l.y, static_cast<Uint8>(PaletteColor::RED));
}
}
// LeftSurfaces
if (true) {
{
for (auto l : left_walls_) {
surface->drawLine(l.x, l.y1, l.x, l.y2, static_cast<Uint8>(PaletteColor::GREEN));
}
}
// RightSurfaces
if (true) {
{
for (auto l : right_walls_) {
surface->drawLine(l.x, l.y1, l.x, l.y2, static_cast<Uint8>(PaletteColor::MAGENTA));
}
}
// LeftSlopes
if (true) {
{
for (auto l : left_slopes_) {
surface->drawLine(l.x1, l.y1, l.x2, l.y2, static_cast<Uint8>(PaletteColor::CYAN));
}
}
// RightSlopes
if (true) {
{
for (auto l : right_slopes_) {
surface->drawLine(l.x1, l.y1, l.x2, l.y2, static_cast<Uint8>(PaletteColor::YELLOW));
}
}
// AutoSurfaces
if (true) {
{
for (auto l : conveyor_belt_floors_) {
surface->drawLine(l.x1, l.y, l.x2, l.y, static_cast<Uint8>(PaletteColor::WHITE));
}
@@ -540,17 +540,17 @@ TileType Room::getTile(int index) {
}
// Las filas 18-20 es de tiles t_animated
else if ((tile_map_[index] >= 18 * tile_set_width_) && (tile_map_[index] < 21 * tile_set_width_)) {
if ((tile_map_[index] >= 18 * tile_set_width_) && (tile_map_[index] < 21 * tile_set_width_)) {
return TileType::ANIMATED;
}
// La fila 21 es de tiles t_slope_r
else if ((tile_map_[index] >= 21 * tile_set_width_) && (tile_map_[index] < 22 * tile_set_width_)) {
if ((tile_map_[index] >= 21 * tile_set_width_) && (tile_map_[index] < 22 * tile_set_width_)) {
return TileType::SLOPE_R;
}
// La fila 22 es de tiles t_slope_l
else if ((tile_map_[index] >= 22 * tile_set_width_) && (tile_map_[index] < 23 * tile_set_width_)) {
if ((tile_map_[index] >= 22 * tile_set_width_) && (tile_map_[index] < 23 * tile_set_width_)) {
return TileType::SLOPE_L;
}

View File

@@ -75,10 +75,10 @@ void Stats::addVisit(const std::string& name) {
}
// Busca una entrada en la lista por nombre
int Stats::findByName(const std::string& name, const std::vector<StatsData>& list_) {
int Stats::findByName(const std::string& name, const std::vector<StatsData>& list) {
int i = 0;
for (const auto& l : list_) {
for (const auto& l : list) {
if (l.name == name) {
return i;
}
@@ -89,8 +89,8 @@ int Stats::findByName(const std::string& name, const std::vector<StatsData>& lis
}
// Carga las estadisticas desde un fichero
bool Stats::loadFromFile(const std::string& file_path, std::vector<StatsData>& list_) {
list_.clear();
bool Stats::loadFromFile(const std::string& file_path, std::vector<StatsData>& list) {
list.clear();
// Indicador de éxito en la carga
bool success = true;
@@ -121,7 +121,7 @@ bool Stats::loadFromFile(const std::string& file_path, std::vector<StatsData>& l
getline(ss, tmp, ';');
stat.died = std::stoi(tmp);
list_.push_back(stat);
list.push_back(stat);
}
}
@@ -132,20 +132,20 @@ bool Stats::loadFromFile(const std::string& file_path, std::vector<StatsData>& l
// El fichero no existe
else {
// Crea el fichero con los valores por defecto
saveToFile(file_path, list_);
saveToFile(file_path, list);
}
return success;
}
// Guarda las estadisticas en un fichero
void Stats::saveToFile(const std::string& file_path, const std::vector<StatsData>& list_) {
void Stats::saveToFile(const std::string& file_path, const std::vector<StatsData>& list) {
// Crea y abre el fichero de texto
std::ofstream file(file_path);
// Escribe en el fichero
file << "# ROOM NAME;VISITS;DEATHS" << std::endl;
for (const auto& item : list_) {
for (const auto& item : list) {
file << item.name << ";" << item.visited << ";" << item.died << std::endl;
}

View File

@@ -27,7 +27,7 @@ class Stats {
static int findByName(const std::string& name, const std::vector<StatsData>& list);
// Carga las estadisticas desde un fichero
bool loadFromFile(const std::string& file_path, std::vector<StatsData>& list);
static bool loadFromFile(const std::string& file_path, std::vector<StatsData>& list);
// Guarda las estadisticas en un fichero
static void saveToFile(const std::string& file_path, const std::vector<StatsData>& list);