forked from github/server
move race_name_func registrations into race.c
This commit is contained in:
parent
0f3de70ced
commit
514565d66b
|
@ -319,6 +319,10 @@ const char *dbrace(const struct race *rc)
|
||||||
return zText;
|
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) {
|
char * race_namegen(const struct race *rc, const struct unit *u) {
|
||||||
if (rc->generate_name) {
|
if (rc->generate_name) {
|
||||||
const char * str = rc->generate_name(u);
|
const char * str = rc->generate_name(u);
|
||||||
|
|
|
@ -151,7 +151,7 @@ extern "C" {
|
||||||
struct att attack[RACE_ATTACKS];
|
struct att attack[RACE_ATTACKS];
|
||||||
signed char bonus[MAXSKILLS];
|
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 *);
|
const char *(*describe) (const struct unit *, const struct locale *);
|
||||||
void(*age) (struct unit * u);
|
void(*age) (struct unit * u);
|
||||||
bool(*move_allowed) (const struct region *, const struct region *);
|
bool(*move_allowed) (const struct region *, const struct region *);
|
||||||
|
@ -261,6 +261,7 @@ extern "C" {
|
||||||
void give_starting_equipment(const struct equipment *eq,
|
void give_starting_equipment(const struct equipment *eq,
|
||||||
struct unit *u);
|
struct unit *u);
|
||||||
const char *dbrace(const struct race *rc);
|
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);
|
char * race_namegen(const struct race *rc, const struct unit *u);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
|
17
src/names.c
17
src/names.c
|
@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
|
@ -31,8 +32,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
#include <util/bsdstring.h>
|
#include <util/bsdstring.h>
|
||||||
#include <util/functions.h>
|
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
|
#include <util/functions.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
#include <util/unicode.h>
|
#include <util/unicode.h>
|
||||||
|
|
||||||
|
@ -482,11 +483,11 @@ void register_names(void)
|
||||||
/* function name
|
/* function name
|
||||||
* generate a name for a nonplayerunit
|
* generate a name for a nonplayerunit
|
||||||
* race->generate_name() */
|
* race->generate_name() */
|
||||||
register_function((pf_generic)undead_name, "nameundead");
|
register_race_name_function(undead_name, "nameundead");
|
||||||
register_function((pf_generic)skeleton_name, "nameskeleton");
|
register_race_name_function(skeleton_name, "nameskeleton");
|
||||||
register_function((pf_generic)zombie_name, "namezombie");
|
register_race_name_function(zombie_name, "namezombie");
|
||||||
register_function((pf_generic)ghoul_name, "nameghoul");
|
register_race_name_function(ghoul_name, "nameghoul");
|
||||||
register_function((pf_generic)dragon_name, "namedragon");
|
register_race_name_function(dragon_name, "namedragon");
|
||||||
register_function((pf_generic)dracoid_name, "namedracoid");
|
register_race_name_function(dracoid_name, "namedracoid");
|
||||||
register_function((pf_generic)generic_name, "namegeneric");
|
register_race_name_function(generic_name, "namegeneric");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue