extract counting name particles.

This commit is contained in:
Enno Rehling 2016-08-28 19:00:04 +01:00
parent 0ac30c65a1
commit d1b6629281
1 changed files with 42 additions and 35 deletions

View File

@ -49,14 +49,10 @@ static const char *describe_braineater(unit * u, const struct locale *lang)
return LOC(lang, "describe_braineater"); return LOC(lang, "describe_braineater");
} }
static const char *make_names(const char *monster, int *num_postfix, static void count_particles(const char *monster, int *num_prefix, int *num_name, int *num_postfix)
int pprefix, int *num_name, int *num_prefix, int ppostfix)
{ {
int uv, uu, un;
static char name[NAMESIZE + 1]; // FIXME: static return value
char zText[32];
const char *str; const char *str;
char zText[32];
if (*num_prefix == 0) { if (*num_prefix == 0) {
for (*num_prefix = 0;; ++*num_prefix) { for (*num_prefix = 0;; ++*num_prefix) {
@ -80,11 +76,20 @@ static const char *make_names(const char *monster, int *num_postfix,
break; break;
} }
} }
if (*num_name == 0) {
return NULL;
} }
static const char *make_names(const char *monster, int *num_postfix,
int pprefix, int *num_name, int *num_prefix, int ppostfix)
{
if (*num_name == 0) {
count_particles(monster, num_prefix, num_name, num_postfix);
}
if (*num_name > 0) {
static char name[NAMESIZE + 1]; // FIXME: static return value
char zText[32];
int uv, uu, un;
const char *str;
/* nur 50% aller Namen haben "Vor-Teil" */ /* nur 50% aller Namen haben "Vor-Teil" */
uv = rng_int() % (*num_prefix * pprefix); uv = rng_int() % (*num_prefix * pprefix);
@ -123,6 +128,8 @@ static const char *make_names(const char *monster, int *num_postfix,
} }
return name; return name;
} }
return NULL;
}
static const char *undead_name(const unit * u) static const char *undead_name(const unit * u)
{ {