This commit is contained in:
2026-04-11 18:40:03 +02:00
parent bb38600aac
commit 72741896c1
27 changed files with 163 additions and 163 deletions

View File

@@ -3,12 +3,12 @@
#include <algorithm> // Para std::ranges::any_of
// Comprueba si la habitación ya ha sido visitada
auto RoomTracker::hasBeenVisited(const std::string& name) -> bool { // NOLINT(readability-convert-member-functions-to-static)
auto RoomTracker::hasBeenVisited(const std::string& name) -> bool {
return std::ranges::any_of(rooms_, [&name](const auto& l) -> bool { return l == name; });
}
// Añade la habitación a la lista
auto RoomTracker::addRoom(const std::string& name) -> bool { // NOLINT(readability-convert-member-functions-to-static)
auto RoomTracker::addRoom(const std::string& name) -> bool {
// Comprueba si la habitación ya ha sido visitada
if (!hasBeenVisited(name)) {
// En caso contrario añádela a la lista