afegir i borrar rooms

This commit is contained in:
2026-04-02 22:14:19 +02:00
parent cea5492abc
commit 7287d65ca3
4 changed files with 336 additions and 11 deletions

View File

@@ -595,6 +595,19 @@ static auto cmd_room(const std::vector<std::string>& args) -> std::string {
if (SceneManager::current != SceneManager::Scene::GAME) { return "Only available in GAME scene"; }
if (args.empty()) { return "usage: room <1-60>|next|prev|left|right|up|down"; }
// DELETE: borrar la habitación actual
if (args[0] == "DELETE") {
if (!MapEditor::get() || !MapEditor::get()->isActive()) { return "Editor not active"; }
return MapEditor::get()->deleteRoom();
}
// NEW [LEFT|RIGHT|UP|DOWN]: crear habitación nueva (opcionalmente conectada)
if (args[0] == "NEW") {
if (!MapEditor::get() || !MapEditor::get()->isActive()) { return "Editor not active"; }
std::string direction = (args.size() >= 2) ? args[1] : "";
return MapEditor::get()->createNewRoom(direction);
}
// Direcciones: LEFT, RIGHT, UP, DOWN
if (args[0] == "LEFT" || args[0] == "RIGHT" || args[0] == "UP" || args[0] == "DOWN") {
if (!GameControl::get_adjacent_room) { return "Game not initialized"; }