canvi de pc

This commit is contained in:
2025-06-27 23:07:31 +02:00
parent 13860af98e
commit ac8d168893
5 changed files with 24 additions and 34 deletions

View File

@@ -167,4 +167,23 @@ int EnterName::findIndex(char character) const
}
}
return 0;
}
}
// Devuelve un nombre al azar
std::string EnterName::getRandomName()
{
static constexpr std::array<std::string_view, 8> NAMES = {
"BAL1", "TABE", "DOC", "MON", "SAM1", "JORDI", "JDES", "PEPE"};
return std::string(NAMES[rand() % NAMES.size()]);
}
// Obtiene el nombre final introducido
std::string EnterName::getFinalName()
{
auto name = trim(name_.substr(0, position_));
if (name.empty())
{
name = getRandomName();
}
name_ = name;
return name_;
}