corregida la llista de inicialització en clang-format
creat Balloon::Config per a inicialitzar globos
This commit is contained in:
@@ -45,8 +45,8 @@ void EnterName::incPosition() {
|
||||
} else if (position_ > 0) // No es necesario verificar position_ < MAX_NAME_LENGTH
|
||||
{
|
||||
// Copiamos el índice del carácter anterior si es posible.
|
||||
//character_index_[position_] = character_index_[position_ - 1];
|
||||
|
||||
// character_index_[position_] = character_index_[position_ - 1];
|
||||
|
||||
// Ponemos el caracter "espacio"
|
||||
character_index_[position_] = 0;
|
||||
} else {
|
||||
@@ -147,12 +147,19 @@ auto EnterName::findIndex(char character) const -> int {
|
||||
// Devuelve un nombre al azar
|
||||
auto EnterName::getRandomName() -> std::string {
|
||||
static constexpr std::array<std::string_view, 8> NAMES = {
|
||||
"BAL1", "TABE", "DOC", "MON", "SAM1", "JORDI", "JDES", "PEPE"};
|
||||
"BAL1",
|
||||
"TABE",
|
||||
"DOC",
|
||||
"MON",
|
||||
"SAM1",
|
||||
"JORDI",
|
||||
"JDES",
|
||||
"PEPE"};
|
||||
return std::string(NAMES[rand() % NAMES.size()]);
|
||||
}
|
||||
// Obtiene el nombre final introducido
|
||||
auto EnterName::getFinalName() -> std::string {
|
||||
auto name = trim(name_.substr(0, position_ + 1)); // Devuelve el texto intruducido incluyendo el del selector
|
||||
auto name = trim(name_.substr(0, position_ + 1)); // Devuelve el texto intruducido incluyendo el del selector
|
||||
if (name.empty()) {
|
||||
name = getRandomName();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user