move race_name_func registrations into race.c

This commit is contained in:
Enno Rehling 2016-08-28 20:02:45 +01:00
parent 0f3de70ced
commit 514565d66b
3 changed files with 15 additions and 9 deletions

View File

@ -319,6 +319,10 @@ const char *dbrace(const struct race *rc)
return zText;
}
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, const struct unit *u) {
if (rc->generate_name) {
const char * str = rc->generate_name(u);

View File

@ -151,7 +151,7 @@ extern "C" {
struct att attack[RACE_ATTACKS];
signed char bonus[MAXSKILLS];
const char *(*generate_name) (const struct unit *);
race_name_func generate_name;
const char *(*describe) (const struct unit *, const struct locale *);
void(*age) (struct unit * u);
bool(*move_allowed) (const struct region *, const struct region *);
@ -261,6 +261,7 @@ extern "C" {
void give_starting_equipment(const struct equipment *eq,
struct unit *u);
const char *dbrace(const struct race *rc);
void register_race_name_function(race_name_func, const char *);
char * race_namegen(const struct race *rc, const struct unit *u);
#ifdef __cplusplus

View File

@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* kernel includes */
#include <kernel/unit.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/faction.h>
#include <kernel/race.h>
@ -31,8 +32,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* util includes */
#include <util/base36.h>
#include <util/bsdstring.h>
#include <util/functions.h>
#include <util/language.h>
#include <util/functions.h>
#include <util/rng.h>
#include <util/unicode.h>
@ -482,11 +483,11 @@ void register_names(void)
/* function name
* generate a name for a nonplayerunit
* race->generate_name() */
register_function((pf_generic)undead_name, "nameundead");
register_function((pf_generic)skeleton_name, "nameskeleton");
register_function((pf_generic)zombie_name, "namezombie");
register_function((pf_generic)ghoul_name, "nameghoul");
register_function((pf_generic)dragon_name, "namedragon");
register_function((pf_generic)dracoid_name, "namedracoid");
register_function((pf_generic)generic_name, "namegeneric");
register_race_name_function(undead_name, "nameundead");
register_race_name_function(skeleton_name, "nameskeleton");
register_race_name_function(zombie_name, "namezombie");
register_race_name_function(ghoul_name, "nameghoul");
register_race_name_function(dragon_name, "namedragon");
register_race_name_function(dracoid_name, "namedracoid");
register_race_name_function(generic_name, "namegeneric");
}