CPP-RPG/Location.cpp

32 lines
595 B
C++

#include "Location.h"
#include <time.h>
Location::Location()
: name("Nowhere"),
descriptions({"This is undefined, bruh.", "This doesn't exist, bruh."})
{
static bool initialized = false;
if(!initialized)
{
initialized = true;
srand(time(nullptr));
}
}
Location::Location(std::string setName,
std::vector<std::string> setDescriptions)
: name(setName),
descriptions(setDescriptions)
{
}
const std::string& Location::getName() const
{
return name;
}
const std::string& Location::getDescription() const
{
return descriptions[rand() % descriptions.size()];
}