forked from github/server
fix undead name generation.
This commit is contained in:
parent
0c865dca57
commit
51bebfdb6b
|
@ -369,10 +369,3 @@ void register_race_description_function(race_desc_func func, const char *name) {
|
|||
void register_race_name_function(race_name_func func, const char *name) {
|
||||
register_function((pf_generic)func, name);
|
||||
}
|
||||
|
||||
char * race_namegen(const struct race *rc, struct unit *u) {
|
||||
if (rc->generate_name) {
|
||||
rc->generate_name(u);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -252,7 +252,6 @@ extern "C" {
|
|||
const char *raceprefix(const struct unit *u);
|
||||
void register_race_name_function(race_name_func, const char *);
|
||||
void register_race_description_function(race_desc_func, const char *);
|
||||
char * race_namegen(const struct race *rc, struct unit *u);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1480,15 +1480,9 @@ void default_name(const unit *u, char name[], int len) {
|
|||
|
||||
void name_unit(unit * u)
|
||||
{
|
||||
if (u_race(u)->generate_name) {
|
||||
char *gen_name = race_namegen(u_race(u), u);
|
||||
if (gen_name) {
|
||||
free(u->_name);
|
||||
u->_name = gen_name;
|
||||
}
|
||||
else {
|
||||
unit_setname(u, racename(u->faction->locale, u, u_race(u)));
|
||||
}
|
||||
const race *rc = u_race(u);
|
||||
if (rc->generate_name) {
|
||||
rc->generate_name(u);
|
||||
}
|
||||
else {
|
||||
char name[32];
|
||||
|
|
|
@ -24,7 +24,7 @@ static void test_names(CuTest * tc)
|
|||
locale_setstring(default_locale, "undead_postfix_0", "Kobolde");
|
||||
CuAssertPtrNotNull(tc, foo = (race_name_func)get_function("nameundead"));
|
||||
rc->generate_name = foo;
|
||||
race_namegen(rc, u);
|
||||
rc->generate_name(u);
|
||||
CuAssertStrEquals(tc, "Graue Kobolde", u->_name);
|
||||
CuAssertPtrNotNull(tc, get_function("nameskeleton"));
|
||||
CuAssertPtrNotNull(tc, get_function("namezombie"));
|
||||
|
|
Loading…
Reference in New Issue