mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-11-24 03:07:21 +03:00
4d6b170769
* Fixing compiler warnings with -Wextra * More warnings suppression, WIP * Even more warning fixes * Added new lines at end of text files. * Padding fix * Additional fixes to warnings on different build configurations; added -Wextra to default build pipeline * Fixes for Secplus v1 * -additional warnings * +-Wredundant-decls fixes * FuriHal: print stack overflow task name in console * FuriHal: add missing include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
43 lines
960 B
C
43 lines
960 B
C
#include "random_name.h"
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <stdbool.h>
|
|
#include <furi.h>
|
|
|
|
void set_random_name(char* name, uint8_t max_name_size) {
|
|
static bool rand_generator_inited = false;
|
|
|
|
if(!rand_generator_inited) {
|
|
srand(DWT->CYCCNT);
|
|
rand_generator_inited = true;
|
|
}
|
|
const char* prefix[] = {
|
|
"ancient",
|
|
"hollow",
|
|
"strange",
|
|
"disappeared",
|
|
"unknown",
|
|
"unthinkable",
|
|
"unnamable",
|
|
"nameless",
|
|
"my",
|
|
};
|
|
|
|
const char* suffix[] = {
|
|
"door",
|
|
"entrance",
|
|
"doorway",
|
|
"entry",
|
|
"portal",
|
|
"entree",
|
|
"opening",
|
|
"crack",
|
|
};
|
|
uint8_t prefix_i = rand() % COUNT_OF(prefix);
|
|
uint8_t suffix_i = rand() % COUNT_OF(suffix);
|
|
|
|
sniprintf(name, max_name_size, "%s_%s", prefix[prefix_i], suffix[suffix_i]);
|
|
// Set first symbol to upper case
|
|
name[0] = name[0] - 0x20;
|
|
}
|