forked from github/server
monster name pluralization changes with u->number.
This commit is contained in:
parent
e49d350348
commit
b8bccd7238
|
@ -221,11 +221,7 @@ const char *silbe3[SIL3] = {
|
|||
|
||||
static void generic_name(unit * u)
|
||||
{
|
||||
const char * name = rc_name_s(u_race(u), (u->number == 1) ? NAME_SINGULAR : NAME_PLURAL);
|
||||
name = LOC(u->faction->locale, name);
|
||||
if (name) {
|
||||
unit_setname(u, name);
|
||||
}
|
||||
unit_setname(u, NULL);
|
||||
}
|
||||
|
||||
static void dragon_name(unit * u)
|
||||
|
|
|
@ -42,12 +42,18 @@ static void test_monster_names(CuTest *tc) {
|
|||
|
||||
test_setup();
|
||||
register_names();
|
||||
default_locale = test_create_locale();
|
||||
locale_setstring(default_locale, "race::irongolem", "Eisengolem");
|
||||
locale_setstring(default_locale, "race::irongolem_p", "Eisengolems");
|
||||
rc = test_create_race("irongolem");
|
||||
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, 0));
|
||||
CuAssertPtrNotNull(tc, u->_name);
|
||||
rc->generate_name = (race_name_func)get_function("namegeneric");
|
||||
rc->generate_name(u);
|
||||
CuAssertPtrEquals(tc, 0, u->_name);
|
||||
CuAssertStrEquals(tc, "Eisengolem", unit_getname(u));
|
||||
u->number = 2;
|
||||
CuAssertStrEquals(tc, "Eisengolems", unit_getname(u));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue