diff --git a/conf/e2/catalog.xml b/conf/e2/catalog.xml index 87b1b2207..a66bf0428 100644 --- a/conf/e2/catalog.xml +++ b/conf/e2/catalog.xml @@ -6,7 +6,7 @@ + rewritePrefix="../../res/core/" /> diff --git a/conf/e3/catalog.xml b/conf/e3/catalog.xml index d231ffbfa..beb8b55c9 100644 --- a/conf/e3/catalog.xml +++ b/conf/e3/catalog.xml @@ -6,7 +6,7 @@ + rewritePrefix="../../res/core/" /> diff --git a/conf/e4/catalog.xml b/conf/e4/catalog.xml index d231ffbfa..beb8b55c9 100644 --- a/conf/e4/catalog.xml +++ b/conf/e4/catalog.xml @@ -6,7 +6,7 @@ + rewritePrefix="../../res/core/" /> diff --git a/core/.gitignore b/core/.gitignore deleted file mode 100644 index 98396d6f2..000000000 --- a/core/.gitignore +++ /dev/null @@ -1,16 +0,0 @@ -bin/ -Debug/ -Release/ -*~ -*.user -*.pdb -*.suo -*.sdf -*.opensdf -*.ipch -*.sh -*.tmp -src/*.vcproj.*.user -tags -build-vs2010 -config diff --git a/core/LICENSE b/core/LICENSE deleted file mode 100644 index 00ab17b3d..000000000 --- a/core/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -Copyright (c) 1998-2010, Enno Rehling - Katja Zedel - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/res/catalog-arda.xml b/res/catalog-arda.xml deleted file mode 100644 index 96dbf8d9d..000000000 --- a/res/catalog-arda.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/res/config-arda.xml b/res/config-arda.xml deleted file mode 100644 index 32a837740..000000000 --- a/res/config-arda.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - arda-server@example.com - arda-server@example.com - - - Bitte denke daran, deine Befehle mit dem Betreff - ERESSEA BEFEHLE an arda-server@example.com zu senden. - Remember to send your orders to - arda-server@example.com with the subject ERESSEA ORDERS. - - - ARDA BEFEHLE - ARDA ORDERS - - - ARBEITEN - WORK - - - diff --git a/core/res/armor/chainmail.xml b/res/core/armor/chainmail.xml similarity index 100% rename from core/res/armor/chainmail.xml rename to res/core/armor/chainmail.xml diff --git a/core/res/armor/laenmail.xml b/res/core/armor/laenmail.xml similarity index 100% rename from core/res/armor/laenmail.xml rename to res/core/armor/laenmail.xml diff --git a/core/res/armor/laenshield.xml b/res/core/armor/laenshield.xml similarity index 100% rename from core/res/armor/laenshield.xml rename to res/core/armor/laenshield.xml diff --git a/core/res/armor/plate.xml b/res/core/armor/plate.xml similarity index 100% rename from core/res/armor/plate.xml rename to res/core/armor/plate.xml diff --git a/core/res/armor/rustychainmail.xml b/res/core/armor/rustychainmail.xml similarity index 100% rename from core/res/armor/rustychainmail.xml rename to res/core/armor/rustychainmail.xml diff --git a/core/res/armor/rustyshield.xml b/res/core/armor/rustyshield.xml similarity index 100% rename from core/res/armor/rustyshield.xml rename to res/core/armor/rustyshield.xml diff --git a/core/res/armor/shield.xml b/res/core/armor/shield.xml similarity index 100% rename from core/res/armor/shield.xml rename to res/core/armor/shield.xml diff --git a/core/res/calendar.xml b/res/core/calendar.xml similarity index 100% rename from core/res/calendar.xml rename to res/core/calendar.xml diff --git a/core/res/common/armor.xml b/res/core/common/armor.xml similarity index 100% rename from core/res/common/armor.xml rename to res/core/common/armor.xml diff --git a/core/res/common/buildings.xml b/res/core/common/buildings.xml similarity index 100% rename from core/res/common/buildings.xml rename to res/core/common/buildings.xml diff --git a/core/res/common/construction.xml b/res/core/common/construction.xml similarity index 100% rename from core/res/common/construction.xml rename to res/core/common/construction.xml diff --git a/core/res/common/herbs.xml b/res/core/common/herbs.xml similarity index 100% rename from core/res/common/herbs.xml rename to res/core/common/herbs.xml diff --git a/core/res/common/items.xml b/res/core/common/items.xml similarity index 100% rename from core/res/common/items.xml rename to res/core/common/items.xml diff --git a/core/res/common/luxuries.xml b/res/core/common/luxuries.xml similarity index 100% rename from core/res/common/luxuries.xml rename to res/core/common/luxuries.xml diff --git a/core/res/common/potions.xml b/res/core/common/potions.xml similarity index 100% rename from core/res/common/potions.xml rename to res/core/common/potions.xml diff --git a/core/res/common/resources.xml b/res/core/common/resources.xml similarity index 100% rename from core/res/common/resources.xml rename to res/core/common/resources.xml diff --git a/core/res/common/weapons.xml b/res/core/common/weapons.xml similarity index 100% rename from core/res/common/weapons.xml rename to res/core/common/weapons.xml diff --git a/core/res/de/strings.xml b/res/core/de/strings.xml similarity index 100% rename from core/res/de/strings.xml rename to res/core/de/strings.xml diff --git a/core/res/en/strings.xml b/res/core/en/strings.xml similarity index 100% rename from core/res/en/strings.xml rename to res/core/en/strings.xml diff --git a/core/res/fr/strings.xml b/res/core/fr/strings.xml similarity index 100% rename from core/res/fr/strings.xml rename to res/core/fr/strings.xml diff --git a/core/res/messages.xml b/res/core/messages.xml similarity index 100% rename from core/res/messages.xml rename to res/core/messages.xml diff --git a/core/res/prefixes.xml b/res/core/prefixes.xml similarity index 100% rename from core/res/prefixes.xml rename to res/core/prefixes.xml diff --git a/core/res/resources/cart.xml b/res/core/resources/cart.xml similarity index 100% rename from core/res/resources/cart.xml rename to res/core/resources/cart.xml diff --git a/core/res/resources/horse.xml b/res/core/resources/horse.xml similarity index 100% rename from core/res/resources/horse.xml rename to res/core/resources/horse.xml diff --git a/core/res/resources/hp.xml b/res/core/resources/hp.xml similarity index 100% rename from core/res/resources/hp.xml rename to res/core/resources/hp.xml diff --git a/core/res/resources/iron.xml b/res/core/resources/iron.xml similarity index 100% rename from core/res/resources/iron.xml rename to res/core/resources/iron.xml diff --git a/core/res/resources/laen.xml b/res/core/resources/laen.xml similarity index 100% rename from core/res/resources/laen.xml rename to res/core/resources/laen.xml diff --git a/core/res/resources/log.xml b/res/core/resources/log.xml similarity index 100% rename from core/res/resources/log.xml rename to res/core/resources/log.xml diff --git a/core/res/resources/mallorn.xml b/res/core/resources/mallorn.xml similarity index 100% rename from core/res/resources/mallorn.xml rename to res/core/resources/mallorn.xml diff --git a/core/res/resources/mallornseed.xml b/res/core/resources/mallornseed.xml similarity index 100% rename from core/res/resources/mallornseed.xml rename to res/core/resources/mallornseed.xml diff --git a/core/res/resources/peasant.xml b/res/core/resources/peasant.xml similarity index 100% rename from core/res/resources/peasant.xml rename to res/core/resources/peasant.xml diff --git a/core/res/resources/seed.xml b/res/core/resources/seed.xml similarity index 100% rename from core/res/resources/seed.xml rename to res/core/resources/seed.xml diff --git a/core/res/resources/stone.xml b/res/core/resources/stone.xml similarity index 100% rename from core/res/resources/stone.xml rename to res/core/resources/stone.xml diff --git a/core/res/ships.xml b/res/core/ships.xml similarity index 100% rename from core/res/ships.xml rename to res/core/ships.xml diff --git a/core/res/spellbooks/cerddor.xml b/res/core/spellbooks/cerddor.xml similarity index 100% rename from core/res/spellbooks/cerddor.xml rename to res/core/spellbooks/cerddor.xml diff --git a/core/res/spellbooks/draig.xml b/res/core/spellbooks/draig.xml similarity index 100% rename from core/res/spellbooks/draig.xml rename to res/core/spellbooks/draig.xml diff --git a/core/res/spellbooks/gray.xml b/res/core/spellbooks/gray.xml similarity index 100% rename from core/res/spellbooks/gray.xml rename to res/core/spellbooks/gray.xml diff --git a/core/res/spellbooks/gwyrrd.xml b/res/core/spellbooks/gwyrrd.xml similarity index 100% rename from core/res/spellbooks/gwyrrd.xml rename to res/core/spellbooks/gwyrrd.xml diff --git a/core/res/spellbooks/illaun.xml b/res/core/spellbooks/illaun.xml similarity index 100% rename from core/res/spellbooks/illaun.xml rename to res/core/spellbooks/illaun.xml diff --git a/core/res/spellbooks/tybied.xml b/res/core/spellbooks/tybied.xml similarity index 100% rename from core/res/spellbooks/tybied.xml rename to res/core/spellbooks/tybied.xml diff --git a/core/res/spells.xml b/res/core/spells.xml similarity index 100% rename from core/res/spells.xml rename to res/core/spells.xml diff --git a/core/res/spoils.xml b/res/core/spoils.xml similarity index 100% rename from core/res/spoils.xml rename to res/core/spoils.xml diff --git a/core/res/terrains.xml b/res/core/terrains.xml similarity index 100% rename from core/res/terrains.xml rename to res/core/terrains.xml diff --git a/core/res/weapons/axe.xml b/res/core/weapons/axe.xml similarity index 100% rename from core/res/weapons/axe.xml rename to res/core/weapons/axe.xml diff --git a/core/res/weapons/bow.xml b/res/core/weapons/bow.xml similarity index 100% rename from core/res/weapons/bow.xml rename to res/core/weapons/bow.xml diff --git a/core/res/weapons/catapult.xml b/res/core/weapons/catapult.xml similarity index 100% rename from core/res/weapons/catapult.xml rename to res/core/weapons/catapult.xml diff --git a/core/res/weapons/crossbow.xml b/res/core/weapons/crossbow.xml similarity index 100% rename from core/res/weapons/crossbow.xml rename to res/core/weapons/crossbow.xml diff --git a/core/res/weapons/firesword.xml b/res/core/weapons/firesword.xml similarity index 100% rename from core/res/weapons/firesword.xml rename to res/core/weapons/firesword.xml diff --git a/core/res/weapons/greatbow.xml b/res/core/weapons/greatbow.xml similarity index 100% rename from core/res/weapons/greatbow.xml rename to res/core/weapons/greatbow.xml diff --git a/core/res/weapons/greatsword.xml b/res/core/weapons/greatsword.xml similarity index 100% rename from core/res/weapons/greatsword.xml rename to res/core/weapons/greatsword.xml diff --git a/core/res/weapons/halberd.xml b/res/core/weapons/halberd.xml similarity index 100% rename from core/res/weapons/halberd.xml rename to res/core/weapons/halberd.xml diff --git a/core/res/weapons/laensword.xml b/res/core/weapons/laensword.xml similarity index 100% rename from core/res/weapons/laensword.xml rename to res/core/weapons/laensword.xml diff --git a/core/res/weapons/lance.xml b/res/core/weapons/lance.xml similarity index 100% rename from core/res/weapons/lance.xml rename to res/core/weapons/lance.xml diff --git a/core/res/weapons/mallornbow.xml b/res/core/weapons/mallornbow.xml similarity index 100% rename from core/res/weapons/mallornbow.xml rename to res/core/weapons/mallornbow.xml diff --git a/core/res/weapons/mallorncrossbow.xml b/res/core/weapons/mallorncrossbow.xml similarity index 100% rename from core/res/weapons/mallorncrossbow.xml rename to res/core/weapons/mallorncrossbow.xml diff --git a/core/res/weapons/mallornlance.xml b/res/core/weapons/mallornlance.xml similarity index 100% rename from core/res/weapons/mallornlance.xml rename to res/core/weapons/mallornlance.xml diff --git a/core/res/weapons/mallornspear.xml b/res/core/weapons/mallornspear.xml similarity index 100% rename from core/res/weapons/mallornspear.xml rename to res/core/weapons/mallornspear.xml diff --git a/core/res/weapons/rep_crossbow.xml b/res/core/weapons/rep_crossbow.xml similarity index 100% rename from core/res/weapons/rep_crossbow.xml rename to res/core/weapons/rep_crossbow.xml diff --git a/core/res/weapons/runesword.xml b/res/core/weapons/runesword.xml similarity index 100% rename from core/res/weapons/runesword.xml rename to res/core/weapons/runesword.xml diff --git a/core/res/weapons/rustyaxe.xml b/res/core/weapons/rustyaxe.xml similarity index 100% rename from core/res/weapons/rustyaxe.xml rename to res/core/weapons/rustyaxe.xml diff --git a/core/res/weapons/rustygreatsword.xml b/res/core/weapons/rustygreatsword.xml similarity index 100% rename from core/res/weapons/rustygreatsword.xml rename to res/core/weapons/rustygreatsword.xml diff --git a/core/res/weapons/rustyhalberd.xml b/res/core/weapons/rustyhalberd.xml similarity index 100% rename from core/res/weapons/rustyhalberd.xml rename to res/core/weapons/rustyhalberd.xml diff --git a/core/res/weapons/rustysword.xml b/res/core/weapons/rustysword.xml similarity index 100% rename from core/res/weapons/rustysword.xml rename to res/core/weapons/rustysword.xml diff --git a/core/res/weapons/spear.xml b/res/core/weapons/spear.xml similarity index 100% rename from core/res/weapons/spear.xml rename to res/core/weapons/spear.xml diff --git a/core/res/weapons/sword.xml b/res/core/weapons/sword.xml similarity index 100% rename from core/res/weapons/sword.xml rename to res/core/weapons/sword.xml diff --git a/src/kernel/jsonconf.c b/src/kernel/jsonconf.c index 232a8890a..a0aabc51c 100644 --- a/src/kernel/jsonconf.c +++ b/src/kernel/jsonconf.c @@ -210,7 +210,10 @@ static void json_terrain(cJSON *json, terrain_type *ter) { static void json_building(cJSON *json, building_type *bt) { cJSON *child; - if (json->type!=cJSON_Object) { + const char *flags[] = { + "nodestroy", "nobuild", "unique", "decay", "dynamic", "magic", "oneperturn", "namechange", 0 + }; + if (json->type != cJSON_Object) { log_error_n("building %s is not a json object: %d", json->string, json->type); return; } @@ -223,6 +226,9 @@ static void json_building(cJSON *json, building_type *bt) { else if (strcmp(child->string, "maintenance") == 0) { json_maintenance(child, &bt->maintenance); } + else if (strcmp(child->string, "flags") == 0) { + json_flags(child, flags); + } break; case cJSON_Object: if (strcmp(child->string, "construction")==0) { diff --git a/src/kernel/order.c b/src/kernel/order.c index 699035bb2..857713a3b 100644 --- a/src/kernel/order.c +++ b/src/kernel/order.c @@ -111,7 +111,7 @@ static char* get_command(const order *ord, char *sbuffer, size_t size) { const struct locale *lang = ORD_LOCALE(ord); if (size > 0) { const char *str = (const char *)LOC(lang, keyword(kwd)); - assert(str); + assert(str); if (text) --size; bytes = (int)strlcpy(bufp, str, size); if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER(); diff --git a/src/kernel/race.c b/src/kernel/race.c index 27df11209..110dd4c5a 100644 --- a/src/kernel/race.c +++ b/src/kernel/race.c @@ -261,7 +261,7 @@ const char *raceprefix(const unit * u) const char *racename(const struct locale *loc, const unit * u, const race * rc) { - const char *prefix = raceprefix(u); + const char *str, *prefix = raceprefix(u); if (prefix != NULL) { static char lbuf[80]; @@ -283,7 +283,8 @@ const char *racename(const struct locale *loc, const unit * u, const race * rc) return lbuf; } - return LOC(loc, rc_name(rc, u->number != 1)); + str = LOC(loc, rc_name(rc, u->number != 1)); + return str ? str : rc->_name[0]; } int diff --git a/src/modules/autoseed.c b/src/modules/autoseed.c index a28944b1b..d06863cd4 100644 --- a/src/modules/autoseed.c +++ b/src/modules/autoseed.c @@ -201,9 +201,6 @@ int fix_demand(region * rd) } for (rl = rlist; rl; rl = rl->next) { region *r = rl->data; - if (!fval(r, RF_CHAOTIC)) { - log_debug("fixing demand in %s\n", regionname(r, NULL)); - } sale = mlux[rng_int() % maxlux]; if (sale) setluxuries(r, sale); diff --git a/src/tools/atoi36.c b/src/tools/atoi36.c new file mode 100644 index 000000000..b93fab3a4 --- /dev/null +++ b/src/tools/atoi36.c @@ -0,0 +1,36 @@ +/* vi: set ts=2: + +-------------------+ Christian Schlittchen + | | Enno Rehling + | Eressea PBEM host | Katja Zedel + | (c) 1998 - 2001 | Henning Peters + | | Ingo Wilken + +-------------------+ Stefan Reich + + This program may not be used, modified or distributed + without prior permission by the authors of Eressea. +*/ + +#include +#include +#include +#include + +int main(int argc, char **argv) +{ + int i = 1, reverse = 0; + if (strstr(argv[0], "itoa36")) + reverse = 1; + if (argc > 1) { + if (strcmp(argv[1], "-r") == 0) { + i = 2; + reverse = 1; + } + } + for (; i != argc; ++i) { + if (reverse) { + printf("%s -> %s\n", argv[i], itoa36(atoi(argv[i]))); + } else + printf("%s -> %d\n", argv[i], atoi36(argv[i])); + } + return 0; +} diff --git a/src/tools/gethash.c b/src/tools/gethash.c new file mode 100644 index 000000000..75054b11e --- /dev/null +++ b/src/tools/gethash.c @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char **argv) +{ + char key[4]; + char code[4]; + char result[4]; + int a, i, rot; + for (a = 1; a < argc; ++a) { + const char *str = argv[a]; + size_t len = strlen(str); + str = str + len - 6; + memcpy(key, str, 3); + memcpy(code, str + 3, 3); + result[3] = key[3] = code[3] = 0; + rot = atoi(key); + for (i = 0; i != 3; ++i) + result[(i + rot) % 3] = ((code[i] + 10 - key[i]) % 10) + '0'; + printf("%s %s\n", argv[a], result); + } + return 0; +} diff --git a/src/tools/namegen.c b/src/tools/namegen.c new file mode 100644 index 000000000..924524179 --- /dev/null +++ b/src/tools/namegen.c @@ -0,0 +1,244 @@ +/* vi: set ts=2: + +-------------------+ Christian Schlittchen + | | Enno Rehling + | Eressea PBEM host | Katja Zedel + | (c) 1998 - 2001 | Henning Peters + | | Ingo Wilken + +-------------------+ Stefan Reich + + This program may not be used, modified or distributed + without prior permission by the authors of Eressea. + + */ + +#include +#include +#include + +static char *dwarf_syllable1[] = { + "B", "D", "F", "G", "Gl", "H", "K", "L", "M", "N", "R", "S", "T", "Th", "V", +}; + +static char *dwarf_syllable2[] = { + "a", "e", "i", "o", "oi", "u", +}; + +static char *dwarf_syllable3[] = { + "bur", "fur", "gan", "gnus", "gnar", "li", "lin", "lir", "mli", "nar", "nus", + "rin", "ran", "sin", "sil", "sur", +}; + +static char *elf_syllable1[] = { + "Al", "An", "Bal", "Bel", "Cal", "Cel", "El", "Elr", "Elv", "Eow", "Ear", "F", + "Fal", "Fel", "Fin", "G", "Gal", "Gel", "Gl", "Is", "Lan", "Leg", "Lom", + "N", "Nal", "Nel", "S", "Sal", "Sel", "T", "Tal", "Tel", "Thr", "Tin", +}; + +static char *elf_syllable2[] = { + "a", "adrie", "ara", "e", "ebri", "ele", "ere", "i", "io", "ithra", "ilma", + "il-Ga", "ili", "o", "orfi", "u", "y", +}; + +static char *elf_syllable3[] = { + "l", "las", "lad", "ldor", "ldur", "linde", "lith", "mir", "n", "nd", "ndel", + "ndil", "ndir", "nduil", "ng", "mbor", "r", "rith", "ril", "riand", "rion", + "s", "thien", "viel", "wen", "wyn", +}; + +static char *gnome_syllable1[] = { + "Aar", "An", "Ar", "As", "C", "H", "Han", "Har", "Hel", "Iir", "J", "Jan", + "Jar", "K", "L", "M", "Mar", "N", "Nik", "Os", "Ol", "P", "R", "S", "Sam", + "San", "T", "Ter", "Tom", "Ul", "V", "W", "Y", +}; + +static char *gnome_syllable2[] = { + "a", "aa", "ai", "e", "ei", "i", "o", "uo", "u", "uu", +}; + +static char *gnome_syllable3[] = { + "ron", "re", "la", "ki", "kseli", "ksi", "ku", "ja", "ta", "na", "namari", + "neli", "nika", "nikki", "nu", "nukka", "ka", "ko", "li", "kki", "rik", + "po", "to", "pekka", "rjaana", "rjatta", "rjukka", "la", "lla", "lli", "mo", + "nni", +}; + +static char *hobbit_syllable1[] = { + "B", "Ber", "Br", "D", "Der", "Dr", "F", "Fr", "G", "H", "L", "Ler", "M", + "Mer", "N", "P", "Pr", "Per", "R", "S", "T", "W", +}; + +static char *hobbit_syllable2[] = { + "a", "e", "i", "ia", "o", "oi", "u", +}; + +static char *hobbit_syllable3[] = { + "bo", "ck", "decan", "degar", "do", "doc", "go", "grin", "lba", "lbo", "lda", + "ldo", "lla", "ll", "lo", "m", "mwise", "nac", "noc", "nwise", "p", "ppin", + "pper", "tho", "to", +}; + +static char *human_syllable1[] = { + "Ab", "Ac", "Ad", "Af", "Agr", "Ast", "As", "Al", "Adw", "Adr", "Ar", "B", + "Br", "C", "Cr", "Ch", "Cad", "D", "Dr", "Dw", "Ed", "Eth", "Et", "Er", + "El", "Eow", "F", "Fr", "G", "Gr", "Gw", "Gal", "Gl", "H", "Ha", "Ib", + "Jer", "K", "Ka", "Ked", "L", "Loth", "Lar", "Leg", "M", "Mir", "N", "Nyd", + "Ol", "Oc", "On", "P", "Pr", "R", "Rh", "S", "Sev", "T", "Tr", "Th", "V", + "Y", "Z", "W", "Wic", +}; + +static char *human_syllable2[] = { + "a", "ae", "au", "ao", "are", "ale", "ali", "ay", "ardo", "e", "ei", "ea", + "eri", "era", "ela", "eli", "enda", "erra", "i", "ia", "ie", "ire", "ira", + "ila", "ili", "ira", "igo", "o", "oa", "oi", "oe", "ore", "u", "y", +}; + +static char *human_syllable3[] = { + "a", "and", "b", "bwyn", "baen", "bard", "c", "ctred", "cred", "ch", "can", + "d", "dan", "don", "der", "dric", "dfrid", "dus", "f", "g", "gord", "gan", + "l", "li", "lgrin", "lin", "lith", "lath", "loth", "ld", "ldric", "ldan", + "m", "mas", "mos", "mar", "mond", "n", "nydd", "nidd", "nnon", "nwan", + "nyth", "nad", "nn", "nnor", "nd", "p", "r", "ron", "rd", "s", "sh", "seth", + "sean", "t", "th", "tha", "tlan", "trem", "tram", "v", "vudd", "w", "wan", + "win", "wyn", "wyr", "wyr", "wyth", +}; + +static char *orc_syllable1[] = { + "B", "Er", "G", "Gr", "H", "P", "Pr", "R", "V", "Vr", "T", "Tr", "M", "Dr", +}; + +static char *orc_syllable2[] = { + "a", "i", "o", "oo", "u", "ui", +}; + +static char *orc_syllable3[] = { + "dash", "dish", "dush", "gar", "gor", "gdush", "lo", "gdish", "k", "lg", + "nak", "rag", "rbag", "rg", "rk", "ng", "nk", "rt", "ol", "urk", "shnak", + "mog", "mak", "rak", +}; + +static char *entish_syllable1[] = { + "Baum", "Wurzel", "Rinden", "Ast", "Blatt", +}; + +static char *entish_syllable2[] = { + "-", +}; + +static char *entish_syllable3[] = { + "Hüter", "Pflanzer", "Hirte", "Wächter", "Wachser", "Beschützer", +}; + +static char *cthuloid_syllable1[] = { + "Cth", "Az", "Fth", "Ts", "Xo", "Q'N", "R'L", "Ghata", "L", "Zz", "Fl", "Cl", + "S", "Y", +}; + +static char *cthuloid_syllable2[] = { + "nar", "loi", "ul", "lu", "noth", "thon", "ath", "'N", "rhy", "oth", "aza", + "agn", "oa", "og", +}; + +static char *cthuloid_syllable3[] = { + "l", "a", "u", "oa", "oggua", "oth", "ath", "aggua", "lu", "lo", "loth", + "lotha", "agn", "axl", +}; + +static char *create_random_name(race_t race) +{ + static char name[64]; + + switch (race) { + case RC_DWARF: + strcpy(name, + dwarf_syllable1[rng_int() % (sizeof(dwarf_syllable1) / + sizeof(char *))]); + strcat(name, + dwarf_syllable2[rand() % (sizeof(dwarf_syllable2) / sizeof(char *))]); + strcat(name, + dwarf_syllable3[rand() % (sizeof(dwarf_syllable3) / sizeof(char *))]); + break; + case RC_ELF: + strcpy(name, + elf_syllable1[rand() % (sizeof(elf_syllable1) / sizeof(char *))]); + strcat(name, + elf_syllable2[rand() % (sizeof(elf_syllable2) / sizeof(char *))]); + strcat(name, + elf_syllable3[rand() % (sizeof(elf_syllable3) / sizeof(char *))]); + break; +/* + case RACE_GNOME: + strcpy(name, gnome_syllable1[rand()%(sizeof(gnome_syllable1) / sizeof(char*))]); + strcat(name, gnome_syllable2[rand()%(sizeof(gnome_syllable2) / sizeof(char*))]); + strcat(name, gnome_syllable3[rand()%(sizeof(gnome_syllable3) / sizeof(char*))]); + break; +*/ + case RC_HALFLING: + strcpy(name, + hobbit_syllable1[rand() % (sizeof(hobbit_syllable1) / sizeof(char *))]); + strcat(name, + hobbit_syllable2[rand() % (sizeof(hobbit_syllable2) / sizeof(char *))]); + strcat(name, + hobbit_syllable3[rand() % (sizeof(hobbit_syllable3) / sizeof(char *))]); + break; + case RC_HUMAN: + case RC_AQUARIAN: + case RC_CAT: + strcpy(name, + human_syllable1[rand() % (sizeof(human_syllable1) / sizeof(char *))]); + strcat(name, + human_syllable2[rand() % (sizeof(human_syllable2) / sizeof(char *))]); + strcat(name, + human_syllable3[rand() % (sizeof(human_syllable3) / sizeof(char *))]); + break; + case RC_ORC: + case RC_TROLL: + case RC_GOBLIN: + strcpy(name, + orc_syllable1[rand() % (sizeof(orc_syllable1) / sizeof(char *))]); + strcat(name, + orc_syllable2[rand() % (sizeof(orc_syllable2) / sizeof(char *))]); + strcat(name, + orc_syllable3[rand() % (sizeof(orc_syllable3) / sizeof(char *))]); + break; +/* + case RC_TREEMAN: + strcpy(name, entish_syllable1[rand()%(sizeof(entish_syllable1) / sizeof(char*))]); + strcat(name, entish_syllable2[rand()%(sizeof(entish_syllable2) / sizeof(char*))]); + strcat(name, entish_syllable3[rand()%(sizeof(entish_syllable3) / sizeof(char*))]); + break; +*/ + case RC_DAEMON: + case RC_INSECT: + strcpy(name, + cthuloid_syllable1[rand() % (sizeof(cthuloid_syllable1) / + sizeof(char *))]); + strcat(name, + cthuloid_syllable2[rand() % (sizeof(cthuloid_syllable2) / + sizeof(char *))]); + strcat(name, + cthuloid_syllable3[rand() % (sizeof(cthuloid_syllable3) / + sizeof(char *))]); + break; + default: + name[0] = 0; + break; + } + + return name; +} + +int main(void) +{ + race_t race; + + for (race = 0; race < 11; race++) { + int i; + printf("%d:", (int)race); + for (i = 0; i < 20; i++) { + printf(" %s", create_random_name(race)); + } + printf("\n"); + } + + return 0; +}