This commit is contained in:
2026-04-05 23:47:54 +02:00
parent 25ecc74251
commit c4a26ffa0f
96 changed files with 457 additions and 307 deletions

View File

@@ -14,9 +14,8 @@
#include "utils/utils.hpp" // Para stringToColor, toLower
// Constructor
EditorStatusBar::EditorStatusBar(std::string room_number, std::string room_name)
: room_number_(std::move(room_number)),
room_name_(std::move(room_name)) {
EditorStatusBar::EditorStatusBar(std::string room_number)
: room_number_(std::move(room_number)) {
const float SURFACE_WIDTH = Options::game.width;
constexpr float SURFACE_HEIGHT = 6.0F * Tile::SIZE; // 48 pixels, igual que el scoreboard
@@ -56,8 +55,8 @@ void EditorStatusBar::fillTexture() {
const Uint8 VALUE_COLOR = stringToColor("white");
const Uint8 DETAIL_COLOR = stringToColor("bright_yellow");
// Línea 1: Nombre de la habitación
text->writeColored(LEFT_X, LINE1_Y, toLower(room_number_ + " " + room_name_), LABEL_COLOR);
// Línea 1: Número de la habitación
text->writeColored(LEFT_X, LINE1_Y, toLower(room_number_), LABEL_COLOR);
// Línea 2: Propiedades de room o info de enemigo
if (!line2_.empty()) {

View File

@@ -11,7 +11,7 @@ class Surface;
class EditorStatusBar {
public:
EditorStatusBar(std::string room_number, std::string room_name);
explicit EditorStatusBar(std::string room_number);
~EditorStatusBar() = default;
void render();
@@ -40,7 +40,6 @@ class EditorStatusBar {
// Variables
std::string room_number_; // Número de la habitación
std::string room_name_; // Nombre de la habitación
int mouse_tile_x_{0}; // Coordenada X del ratón en tiles
int mouse_tile_y_{0}; // Coordenada Y del ratón en tiles
std::string line2_; // Contenido de la línea 2

View File

@@ -219,7 +219,7 @@ void MapEditor::enter(std::shared_ptr<Room> room, std::shared_ptr<Player> player
room_->resetEnemyPositions(room_data_.enemies);
// Crear la barra de estado
statusbar_ = std::make_unique<EditorStatusBar>(room_->getNumber(), room_->getName());
statusbar_ = std::make_unique<EditorStatusBar>(room_->getNumber());
// Resetear estado
drag_ = {};
@@ -1320,7 +1320,6 @@ auto MapEditor::createNewRoom(const std::string& direction) -> std::string { //
// Crear Room::Data por defecto con conexión recíproca
Room::Data new_room;
new_room.number = std::string(name_buf).substr(0, std::string(name_buf).find('.'));
new_room.name = "NO_NAME";
new_room.bg_color = "black";
new_room.border_color = "magenta";
new_room.tile_set_file = "standard.gif";

View File

@@ -37,25 +37,12 @@ auto RoomSaver::conveyorBeltToString(int direction) -> std::string {
// Genera el YAML completo como texto con formato compacto
auto RoomSaver::buildYAML(const fkyaml::node& original_yaml, const Room::Data& room_data) -> std::string { // NOLINT(readability-function-cognitive-complexity)
(void)original_yaml; // Ya no se usa; mantenido para compatibilidad con la firma de saveYAML
std::ostringstream out;
// --- Cabecera: nombre como comentario ---
out << "# " << room_data.name << "\n";
// --- Sección room ---
out << "room:\n";
// Escribir todos los campos name_* del YAML original (preserva name_ca, name_en, etc.)
if (original_yaml.contains("room")) {
const auto& room_node = original_yaml["room"];
for (auto it = room_node.begin(); it != room_node.end(); ++it) {
const auto KEY = it.key().get_value<std::string>();
if (KEY.substr(0, 5) == "name_") {
out << " " << KEY << ": \"" << it.value().get_value<std::string>() << "\"\n";
}
}
}
out << " bgColor: " << room_data.bg_color << "\n";
out << " border: " << room_data.border_color << "\n";
out << " tileSetFile: " << room_data.tile_set_file << "\n";