CPP-RPG/Location.cpp

32 lines
595 B
C++
Raw Normal View History

2021-01-25 21:40:08 -05:00
#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()];
}