al eixir del editor, recarrega la habitació nova
This commit is contained in:
@@ -316,6 +316,25 @@ void RoomLoader::parseItems(const fkyaml::node& yaml, Room::Data& room, bool ver
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
// Carga una habitación desde un string YAML (para el editor de mapas, evita el resource pack)
|
||||
auto RoomLoader::loadFromString(const std::string& yaml_content, const std::string& file_name) -> Room::Data {
|
||||
Room::Data room;
|
||||
try {
|
||||
auto yaml = fkyaml::node::deserialize(yaml_content);
|
||||
parseRoomConfig(yaml, room, file_name);
|
||||
parseTilemap(yaml, room, file_name, false);
|
||||
parseEnemies(yaml, room, false);
|
||||
parseItems(yaml, room, false);
|
||||
} catch (const fkyaml::exception& e) {
|
||||
std::cerr << "YAML parsing error in " << file_name << ": " << e.what() << '\n';
|
||||
} catch (const std::exception& e) {
|
||||
std::cerr << "Error loading room " << file_name << ": " << e.what() << '\n';
|
||||
}
|
||||
return room;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Carga un archivo de room en formato YAML
|
||||
auto RoomLoader::loadYAML(const std::string& file_path, bool verbose) -> Room::Data { // NOLINT(readability-convert-member-functions-to-static)
|
||||
Room::Data room;
|
||||
|
||||
@@ -46,6 +46,9 @@ class RoomLoader {
|
||||
* - items: lista de items (opcional)
|
||||
*/
|
||||
static auto loadYAML(const std::string& file_path, bool verbose = false) -> Room::Data;
|
||||
#ifdef _DEBUG
|
||||
static auto loadFromString(const std::string& yaml_content, const std::string& file_name) -> Room::Data;
|
||||
#endif
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user