creada carpeta source2
This commit is contained in:
29
source2/Game/Gameplay/room_tracker.cpp
Normal file
29
source2/Game/Gameplay/room_tracker.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include "room_tracker.h"
|
||||
|
||||
// Comprueba si la habitación ya ha sido visitada
|
||||
bool RoomTracker::hasBeenVisited(const std::string &name)
|
||||
{
|
||||
for (const auto &l : list)
|
||||
{
|
||||
if (l == name)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Añade la habitación a la lista
|
||||
bool RoomTracker::addRoom(const std::string &name)
|
||||
{
|
||||
// Comprueba si la habitación ya ha sido visitada
|
||||
if (!hasBeenVisited(name))
|
||||
{
|
||||
// En caso contrario añádela a la lista
|
||||
list.push_back(name);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user