< index < 16. Name generator < 16.1 Creating a generator |
===================================== | > 16.3 Destroying a generator |
C++ : static char * TCODNamegen::generate(char * name, bool allocate = false) C : char * TCOD_namegen_generate(char * name, bool allocate); Py : namegen_generate(name, allocate=0)
Parameter | Description |
---|---|
name | The structure name you wish to refer to, for instance, "celtic female". For more about how structure names work, please refer to chapters 16.5 and 7.1. |
allocate | Whether memory should be allocated for the output or not. |
C++ : TCODNamegen::parse("data/names.txt",TCODRandom::getInstance()); char * myName = TCODNamegen::generate("fantasy female"); C : TCOD_namegen_parse("data/names.txt",TCOD_random_get_instance()); char * my_name = TCOD_namegen_generate("Celtic male",false); Py : libtcod.namegen_parse('data/names.txt') name = libtcod.namegen_generate('fantasy female')
C++ : static char * TCODNamegen::generateCustom(char * name, char * rule, bool allocate = false) C : char * TCOD_namegen_generate_custom(char * name, char * rule, bool allocate); Py : namegen_generate_custom(name, rule, allocate=0)
Parameter | Description |
---|---|
name | The structure name you wish to refer to, for instance, "celtic female". For more about how structure names work, please refer to chapters 16.5 and 7.1. |
rule | The name generation rule. See chapter 16.5 for more details. |
allocate | Whether memory should be allocated for the output or not. |
C++ : TCODNamegen::create("data/names.txt",TCODRandom::getInstance()); char * myName = TCODNamegen::generateCustom("Nordic male","$s$e"); C : TCOD_namegen_new("data/names.txt",TCOD_random_get_instance()); char * my_name = TCOD_namegen_generate_custom("Mesopotamian female","$s$e",false); Py : libtcod.namegen_parse('data/names.txt') name = libtcod.namegen_generate('fantasy female','$s$e')