From 5b7cdc4d482f011719303e22a1499c0af1684066 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 31 Dec 2016 20:17:02 +0100 Subject: [PATCH] monster name pluralization changes with u->number. --- src/names.c | 6 +----- src/names.test.c | 6 ++++++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/names.c b/src/names.c index 99c21a05e..cf1cdb910 100644 --- a/src/names.c +++ b/src/names.c @@ -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) diff --git a/src/names.test.c b/src/names.test.c index 176a12a68..8109fc2d4 100644 --- a/src/names.test.c +++ b/src/names.test.c @@ -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(); }