From 662ef3173b5eb27905255929401c7d18b349f8f0 Mon Sep 17 00:00:00 2001 From: smatz Date: Mon, 21 Sep 2009 11:01:16 +0000 Subject: (svn r17597) -Codechange: rename namegen* to townname* --- src/namegen.cpp | 936 ------------ src/namegen_func.h | 17 - src/saveload/oldloader_sl.cpp | 2 +- src/strings.cpp | 2 +- src/table/namegen.h | 3317 ----------------------------------------- src/table/townname.h | 3317 +++++++++++++++++++++++++++++++++++++++++ src/townname.cpp | 936 ++++++++++++ src/townname_func.h | 17 + 8 files changed, 4272 insertions(+), 4272 deletions(-) delete mode 100644 src/namegen.cpp delete mode 100644 src/namegen_func.h delete mode 100644 src/table/namegen.h create mode 100644 src/table/townname.h create mode 100644 src/townname.cpp create mode 100644 src/townname_func.h (limited to 'src') diff --git a/src/namegen.cpp b/src/namegen.cpp deleted file mode 100644 index 211e21d9b..000000000 --- a/src/namegen.cpp +++ /dev/null @@ -1,936 +0,0 @@ -/* $Id$ */ - -/* - * This file is part of OpenTTD. - * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. - * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . - */ - -/** @file namegen.cpp Town name generators. */ - -#include "stdafx.h" -#include "namegen_func.h" -#include "string_func.h" -#include "core/alloc_func.hpp" - -#include "table/namegen.h" - - -/** - * Generates a number from given seed. - * @param shift_by number of bits seed is shifted to the right - * @param max generated number is in interval 0...max-1 - * @param seed seed - * @return seed transformed to a number from given range - */ -static inline uint32 SeedChance(byte shift_by, int max, uint32 seed) -{ - return (GB(seed, shift_by, 16) * max) >> 16; -} - - -/** - * Generates a number from given seed. Uses different algorithm than SeedChance(). - * @param shift_by number of bits seed is shifted to the right - * @param max generated number is in interval 0...max-1 - * @param seed seed - * @return seed transformed to a number from given range - */ -static inline uint32 SeedModChance(byte shift_by, int max, uint32 seed) -{ - /* This actually gives *MUCH* more even distribution of the values - * than SeedChance(), which is absolutely horrible in that. If - * you do not believe me, try with i.e. the Czech town names, - * compare the words (nicely visible on prefixes) generated by - * SeedChance() and SeedModChance(). Do not get dicouraged by the - * never-use-modulo myths, which hold true only for the linear - * congruential generators (and Random() isn't such a generator). - * --pasky - * TODO: Perhaps we should use it for all the name generators? --pasky */ - return (seed >> shift_by) % max; -} - - -/** - * Generates a number from given seed. - * @param shift_by number of bits seed is shifted to the right - * @param max generated number is in interval -bias...max-1 - * @param seed seed - * @param bias minimum value that can be returned - * @return seed transformed to a number from given range - */ -static inline int32 SeedChanceBias(byte shift_by, int max, uint32 seed, int bias) -{ - return SeedChance(shift_by, max + bias, seed) - bias; -} - - -/** - * Replaces a string beginning in 'org' with 'rep'. - * @param org string to replace, has to be 4 characters long - * @param rep string to be replaced with, has to be 4 characters long - * @param buf buffer with string - */ -static void ReplaceWords(const char *org, const char *rep, char *buf) -{ - if (strncmp(buf, org, 4) == 0) strncpy(buf, rep, 4); // Safe as the string in buf is always more than 4 characters long. -} - - -/** - * Replaces english curses and ugly letter combinations by nicer ones. - * @param buf buffer with town name - * @param original English (Original) generator was used - */ -static void ReplaceEnglishWords(char *buf, bool original) -{ - ReplaceWords("Cunt", "East", buf); - ReplaceWords("Slag", "Pits", buf); - ReplaceWords("Slut", "Edin", buf); - if (!original) ReplaceWords("Fart", "Boot", buf); // never happens with 'English (Original)' - ReplaceWords("Drar", "Quar", buf); - ReplaceWords("Dreh", "Bash", buf); - ReplaceWords("Frar", "Shor", buf); - ReplaceWords("Grar", "Aber", buf); - ReplaceWords("Brar", "Over", buf); - ReplaceWords("Wrar", original ? "Inve" : "Stan", buf); -} - -/** - * Generates English (Original) town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeEnglishOriginalTownName(char *buf, const char *last, uint32 seed) -{ - char *orig = buf; - - /* optional first segment */ - int i = SeedChanceBias(0, lengthof(_name_original_english_1), seed, 50); - if (i >= 0) buf = strecpy(buf, _name_original_english_1[i], last); - - /* mandatory middle segments */ - buf = strecpy(buf, _name_original_english_2[SeedChance(4, lengthof(_name_original_english_2), seed)], last); - buf = strecpy(buf, _name_original_english_3[SeedChance(7, lengthof(_name_original_english_3), seed)], last); - buf = strecpy(buf, _name_original_english_4[SeedChance(10, lengthof(_name_original_english_4), seed)], last); - buf = strecpy(buf, _name_original_english_5[SeedChance(13, lengthof(_name_original_english_5), seed)], last); - - /* optional last segment */ - i = SeedChanceBias(15, lengthof(_name_original_english_6), seed, 60); - if (i >= 0) buf = strecpy(buf, _name_original_english_6[i], last); - - /* Ce, Ci => Ke, Ki */ - if (orig[0] == 'C' && (orig[1] == 'e' || orig[1] == 'i')) { - orig[0] = 'K'; - } - - assert(buf - orig >= 4); - ReplaceEnglishWords(orig, true); - - return buf; -} - - -/** - * Generates English (Additional) town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeEnglishAdditionalTownName(char *buf, const char *last, uint32 seed) -{ - char *orig = buf; - - /* optional first segment */ - int i = SeedChanceBias(0, lengthof(_name_additional_english_prefix), seed, 50); - if (i >= 0) buf = strecpy(buf, _name_additional_english_prefix[i], last); - - if (SeedChance(3, 20, seed) >= 14) { - buf = strecpy(buf, _name_additional_english_1a[SeedChance(6, lengthof(_name_additional_english_1a), seed)], last); - } else { - buf = strecpy(buf, _name_additional_english_1b1[SeedChance(6, lengthof(_name_additional_english_1b1), seed)], last); - buf = strecpy(buf, _name_additional_english_1b2[SeedChance(9, lengthof(_name_additional_english_1b2), seed)], last); - if (SeedChance(11, 20, seed) >= 4) { - buf = strecpy(buf, _name_additional_english_1b3a[SeedChance(12, lengthof(_name_additional_english_1b3a), seed)], last); - } else { - buf = strecpy(buf, _name_additional_english_1b3b[SeedChance(12, lengthof(_name_additional_english_1b3b), seed)], last); - } - } - - buf = strecpy(buf, _name_additional_english_2[SeedChance(14, lengthof(_name_additional_english_2), seed)], last); - - /* optional last segment */ - i = SeedChanceBias(15, lengthof(_name_additional_english_3), seed, 60); - if (i >= 0) buf = strecpy(buf, _name_additional_english_3[i], last); - - assert(buf - orig >= 4); - ReplaceEnglishWords(orig, false); - - return buf; -} - - -/** - * Generates Austrian town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeAustrianTownName(char *buf, const char *last, uint32 seed) -{ - /* Bad, Maria, Gross, ... */ - int i = SeedChanceBias(0, lengthof(_name_austrian_a1), seed, 15); - if (i >= 0) buf = strecpy(buf, _name_austrian_a1[i], last); - - int j = 0; - - i = SeedChance(4, 6, seed); - if (i >= 4) { - /* Kaisers-kirchen */ - buf = strecpy(buf, _name_austrian_a2[SeedChance( 7, lengthof(_name_austrian_a2), seed)], last); - buf = strecpy(buf, _name_austrian_a3[SeedChance(13, lengthof(_name_austrian_a3), seed)], last); - } else if (i >= 2) { - /* St. Johann */ - buf = strecpy(buf, _name_austrian_a5[SeedChance( 7, lengthof(_name_austrian_a5), seed)], last); - buf = strecpy(buf, _name_austrian_a6[SeedChance( 9, lengthof(_name_austrian_a6), seed)], last); - j = 1; // More likely to have a " an der " or " am " - } else { - /* Zell */ - buf = strecpy(buf, _name_austrian_a4[SeedChance( 7, lengthof(_name_austrian_a4), seed)], last); - } - - i = SeedChance(1, 6, seed); - if (i >= 4 - j) { - /* an der Donau (rivers) */ - buf = strecpy(buf, _name_austrian_f1[SeedChance(4, lengthof(_name_austrian_f1), seed)], last); - buf = strecpy(buf, _name_austrian_f2[SeedChance(5, lengthof(_name_austrian_f2), seed)], last); - } else if (i >= 2 - j) { - /* am Dachstein (mountains) */ - buf = strecpy(buf, _name_austrian_b1[SeedChance(4, lengthof(_name_austrian_b1), seed)], last); - buf = strecpy(buf, _name_austrian_b2[SeedChance(5, lengthof(_name_austrian_b2), seed)], last); - } - - return buf; -} - - -/** - * Generates German town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeGermanTownName(char *buf, const char *last, uint32 seed) -{ - uint seed_derivative = SeedChance(7, 28, seed); - - /* optional prefix */ - if (seed_derivative == 12 || seed_derivative == 19) { - uint i = SeedChance(2, lengthof(_name_german_pre), seed); - buf = strecpy(buf, _name_german_pre[i], last); - } - - /* mandatory middle segments including option of hardcoded name */ - uint i = SeedChance(3, lengthof(_name_german_real) + lengthof(_name_german_1), seed); - if (i < lengthof(_name_german_real)) { - buf = strecpy(buf, _name_german_real[i], last); - } else { - buf = strecpy(buf, _name_german_1[i - lengthof(_name_german_real)], last); - - i = SeedChance(5, lengthof(_name_german_2), seed); - buf = strecpy(buf, _name_german_2[i], last); - } - - /* optional suffix */ - if (seed_derivative == 24) { - i = SeedChance(9, lengthof(_name_german_4_an_der) + lengthof(_name_german_4_am), seed); - if (i < lengthof(_name_german_4_an_der)) { - buf = strecpy(buf, _name_german_3_an_der[0], last); - buf = strecpy(buf, _name_german_4_an_der[i], last); - } else { - buf = strecpy(buf, _name_german_3_am[0], last); - buf = strecpy(buf, _name_german_4_am[i - lengthof(_name_german_4_an_der)], last); - } - } - - return buf; -} - - -/** - * Generates Latin-American town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeSpanishTownName(char *buf, const char *last, uint32 seed) -{ - return strecpy(buf, _name_spanish_real[SeedChance(0, lengthof(_name_spanish_real), seed)], last); -} - - -/** - * Generates French town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeFrenchTownName(char *buf, const char *last, uint32 seed) -{ - return strecpy(buf, _name_french_real[SeedChance(0, lengthof(_name_french_real), seed)], last); -} - - -/** - * Generates Silly town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeSillyTownName(char *buf, const char *last, uint32 seed) -{ - buf = strecpy(buf, _name_silly_1[SeedChance( 0, lengthof(_name_silly_1), seed)], last); - buf = strecpy(buf, _name_silly_2[SeedChance(16, lengthof(_name_silly_2), seed)], last); - - return buf; -} - - -/** - * Generates Swedish town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeSwedishTownName(char *buf, const char *last, uint32 seed) -{ - /* optional first segment */ - int i = SeedChanceBias(0, lengthof(_name_swedish_1), seed, 50); - if (i >= 0) buf = strecpy(buf, _name_swedish_1[i], last); - - /* mandatory middle segments including option of hardcoded name */ - if (SeedChance(4, 5, seed) >= 3) { - buf = strecpy(buf, _name_swedish_2[SeedChance( 7, lengthof(_name_swedish_2), seed)], last); - } else { - buf = strecpy(buf, _name_swedish_2a[SeedChance( 7, lengthof(_name_swedish_2a), seed)], last); - buf = strecpy(buf, _name_swedish_2b[SeedChance(10, lengthof(_name_swedish_2b), seed)], last); - buf = strecpy(buf, _name_swedish_2c[SeedChance(13, lengthof(_name_swedish_2c), seed)], last); - } - - buf = strecpy(buf, _name_swedish_3[SeedChance(16, lengthof(_name_swedish_3), seed)], last); - - return buf; -} - - -/** - * Generates Dutch town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeDutchTownName(char *buf, const char *last, uint32 seed) -{ - /* optional first segment */ - int i = SeedChanceBias(0, lengthof(_name_dutch_1), seed, 50); - if (i >= 0) buf = strecpy(buf, _name_dutch_1[i], last); - - /* mandatory middle segments including option of hardcoded name */ - if (SeedChance(6, 9, seed) > 4) { - buf = strecpy(buf, _name_dutch_2[SeedChance( 9, lengthof(_name_dutch_2), seed)], last); - } else { - buf = strecpy(buf, _name_dutch_3[SeedChance( 9, lengthof(_name_dutch_3), seed)], last); - buf = strecpy(buf, _name_dutch_4[SeedChance(12, lengthof(_name_dutch_4), seed)], last); - } - - buf = strecpy(buf, _name_dutch_5[SeedChance(15, lengthof(_name_dutch_5), seed)], last); - - return buf; -} - - -/** - * Generates Finnish town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeFinnishTownName(char *buf, const char *last, uint32 seed) -{ - char *orig = buf; - - /* Select randomly if town name should consists of one or two parts. */ - if (SeedChance(0, 15, seed) >= 10) { - return strecpy(buf, _name_finnish_real[SeedChance(2, lengthof(_name_finnish_real), seed)], last); - } - - if (SeedChance(0, 15, seed) >= 5) { - /* A two-part name by combining one of _name_finnish_1 + "la"/"lä" - * The reason for not having the contents of _name_finnish_{1,2} in the same table is - * that the ones in _name_finnish_2 are not good for this purpose. */ - uint sel = SeedChance( 0, lengthof(_name_finnish_1), seed); - buf = strecpy(buf, _name_finnish_1[sel], last); - char *end = buf - 1; - assert(end >= orig); - if (*end == 'i') *end = 'e'; - if (strstr(orig, "a") != NULL || strstr(orig, "o") != NULL || strstr(orig, "u") != NULL || - strstr(orig, "A") != NULL || strstr(orig, "O") != NULL || strstr(orig, "U") != NULL) { - buf = strecpy(buf, "la", last); - } else { - buf = strecpy(buf, "l\xC3\xA4", last); - } - return buf; - } - - /* A two-part name by combining one of _name_finnish_{1,2} + _name_finnish_3. - * Why aren't _name_finnish_{1,2} just one table? See above. */ - uint sel = SeedChance(2, lengthof(_name_finnish_1) + lengthof(_name_finnish_2), seed); - if (sel >= lengthof(_name_finnish_1)) { - buf = strecpy(buf, _name_finnish_2[sel - lengthof(_name_finnish_1)], last); - } else { - buf = strecpy(buf, _name_finnish_1[sel], last); - } - - buf = strecpy(buf, _name_finnish_3[SeedChance(10, lengthof(_name_finnish_3), seed)], last); - - return buf; -} - - -/** - * Generates Polish town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakePolishTownName(char *buf, const char *last, uint32 seed) -{ - /* optional first segment */ - uint i = SeedChance(0, - lengthof(_name_polish_2_o) + lengthof(_name_polish_2_m) + - lengthof(_name_polish_2_f) + lengthof(_name_polish_2_n), - seed); - uint j = SeedChance(2, 20, seed); - - - if (i < lengthof(_name_polish_2_o)) { - return strecpy(buf, _name_polish_2_o[SeedChance(3, lengthof(_name_polish_2_o), seed)], last); - } - - if (i < lengthof(_name_polish_2_m) + lengthof(_name_polish_2_o)) { - if (j < 4) { - buf = strecpy(buf, _name_polish_1_m[SeedChance(5, lengthof(_name_polish_1_m), seed)], last); - } - - buf = strecpy(buf, _name_polish_2_m[SeedChance(7, lengthof(_name_polish_2_m), seed)], last); - - if (j >= 4 && j < 16) { - buf = strecpy(buf, _name_polish_3_m[SeedChance(10, lengthof(_name_polish_3_m), seed)], last); - } - - return buf; - } - - if (i < lengthof(_name_polish_2_f) + lengthof(_name_polish_2_m) + lengthof(_name_polish_2_o)) { - if (j < 4) { - buf = strecpy(buf, _name_polish_1_f[SeedChance(5, lengthof(_name_polish_1_f), seed)], last); - } - - buf = strecpy(buf, _name_polish_2_f[SeedChance(7, lengthof(_name_polish_2_f), seed)], last); - - if (j >= 4 && j < 16) { - buf = strecpy(buf, _name_polish_3_f[SeedChance(10, lengthof(_name_polish_3_f), seed)], last); - } - - return buf; - } - - if (j < 4) { - buf = strecpy(buf, _name_polish_1_n[SeedChance(5, lengthof(_name_polish_1_n), seed)], last); - } - - buf = strecpy(buf, _name_polish_2_n[SeedChance(7, lengthof(_name_polish_2_n), seed)], last); - - if (j >= 4 && j < 16) { - buf = strecpy(buf, _name_polish_3_n[SeedChance(10, lengthof(_name_polish_3_n), seed)], last); - } - - return buf; -} - - -/** - * Generates Czech town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeCzechTownName(char *buf, const char *last, uint32 seed) -{ - /* 1:3 chance to use a real name. */ - if (SeedModChance(0, 4, seed) == 0) { - return strecpy(buf, _name_czech_real[SeedModChance(4, lengthof(_name_czech_real), seed)], last); - } - - const char *orig = buf; - - /* Probability of prefixes/suffixes - * 0..11 prefix, 12..13 prefix+suffix, 14..17 suffix, 18..31 nothing */ - int prob_tails = SeedModChance(2, 32, seed); - bool do_prefix = prob_tails < 12; - bool do_suffix = prob_tails > 11 && prob_tails < 17; - bool dynamic_subst; - - /* IDs of the respective parts */ - int prefix = 0, ending = 0, suffix = 0; - uint postfix = 0; - uint stem; - - /* The select criteria. */ - CzechGender gender; - CzechChoose choose; - CzechAllow allow; - - if (do_prefix) prefix = SeedModChance(5, lengthof(_name_czech_adj) * 12, seed) / 12; - if (do_suffix) suffix = SeedModChance(7, lengthof(_name_czech_suffix), seed); - /* 3:1 chance 3:1 to use dynamic substantive */ - stem = SeedModChance(9, - lengthof(_name_czech_subst_full) + 3 * lengthof(_name_czech_subst_stem), - seed); - if (stem < lengthof(_name_czech_subst_full)) { - /* That was easy! */ - dynamic_subst = false; - gender = _name_czech_subst_full[stem].gender; - choose = _name_czech_subst_full[stem].choose; - allow = _name_czech_subst_full[stem].allow; - } else { - unsigned int map[lengthof(_name_czech_subst_ending)]; - int ending_start = -1, ending_stop = -1; - - /* Load the substantive */ - dynamic_subst = true; - stem -= lengthof(_name_czech_subst_full); - stem %= lengthof(_name_czech_subst_stem); - gender = _name_czech_subst_stem[stem].gender; - choose = _name_czech_subst_stem[stem].choose; - allow = _name_czech_subst_stem[stem].allow; - - /* Load the postfix (1:1 chance that a postfix will be inserted) */ - postfix = SeedModChance(14, lengthof(_name_czech_subst_postfix) * 2, seed); - - if (choose & CZC_POSTFIX) { - /* Always get a real postfix. */ - postfix %= lengthof(_name_czech_subst_postfix); - } - if (choose & CZC_NOPOSTFIX) { - /* Always drop a postfix. */ - postfix += lengthof(_name_czech_subst_postfix); - } - if (postfix < lengthof(_name_czech_subst_postfix)) { - choose |= CZC_POSTFIX; - } else { - choose |= CZC_NOPOSTFIX; - } - - /* Localize the array segment containing a good gender */ - for (ending = 0; ending < (int)lengthof(_name_czech_subst_ending); ending++) { - const CzechNameSubst *e = &_name_czech_subst_ending[ending]; - - if (gender == CZG_FREE || - (gender == CZG_NFREE && e->gender != CZG_SNEUT && e->gender != CZG_PNEUT) || - gender == e->gender) { - if (ending_start < 0) { - ending_start = ending; - } - } else if (ending_start >= 0) { - ending_stop = ending - 1; - break; - } - } - if (ending_stop < 0) { - /* Whoa. All the endings matched. */ - ending_stop = ending - 1; - } - - /* Make a sequential map of the items with good mask */ - size_t i = 0; - for (ending = ending_start; ending <= ending_stop; ending++) { - const CzechNameSubst *e = &_name_czech_subst_ending[ending]; - - if ((e->choose & choose) == choose && (e->allow & allow) != 0) { - map[i++] = ending; - } - } - assert(i > 0); - - /* Load the ending */ - ending = map[SeedModChance(16, (int)i, seed)]; - /* Override possible CZG_*FREE; this must be a real gender, - * otherwise we get overflow when modifying the adjectivum. */ - gender = _name_czech_subst_ending[ending].gender; - assert(gender != CZG_FREE && gender != CZG_NFREE); - } - - if (do_prefix && (_name_czech_adj[prefix].choose & choose) != choose) { - /* Throw away non-matching prefix. */ - do_prefix = false; - } - - /* Now finally construct the name */ - if (do_prefix) { - CzechPattern pattern = _name_czech_adj[prefix].pattern; - - buf = strecpy(buf, _name_czech_adj[prefix].name, last); - - char *endpos = buf - 1; - /* Find the first character in a UTF-8 sequence */ - while (GB(*endpos, 6, 2) == 2) endpos--; - - if (gender == CZG_SMASC && pattern == CZP_PRIVL) { - assert(endpos >= orig + 2); - /* -ovX -> -uv */ - *(endpos - 2) = 'u'; - assert(*(endpos - 1) == 'v'); - *endpos = '\0'; - } else { - assert(endpos >= orig); - endpos = strecpy(endpos, _name_czech_patmod[gender][pattern], last); - } - - buf = strecpy(endpos, " ", last); - } - - if (dynamic_subst) { - buf = strecpy(buf, _name_czech_subst_stem[stem].name, last); - if (postfix < lengthof(_name_czech_subst_postfix)) { - const char *poststr = _name_czech_subst_postfix[postfix]; - const char *endstr = _name_czech_subst_ending[ending].name; - - size_t postlen = strlen(poststr); - size_t endlen = strlen(endstr); - assert(postlen > 0 && endlen > 0); - - /* Kill the "avava" and "Jananna"-like cases */ - if (postlen < 2 || postlen > endlen || - ((poststr[1] != 'v' || poststr[1] != endstr[1]) && - poststr[2] != endstr[1])) { - buf = strecpy(buf, poststr, last); - - /* k-i -> c-i, h-i -> z-i */ - if (endstr[0] == 'i') { - switch (*(buf - 1)) { - case 'k': *(buf - 1) = 'c'; break; - case 'h': *(buf - 1) = 'z'; break; - default: break; - } - } - } - } - buf = strecpy(buf, _name_czech_subst_ending[ending].name, last); - } else { - buf = strecpy(buf, _name_czech_subst_full[stem].name, last); - } - - if (do_suffix) { - buf = strecpy(buf, " ", last); - buf = strecpy(buf, _name_czech_suffix[suffix], last); - } - - return buf; -} - - -/** - * Generates Romanian town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeRomanianTownName(char *buf, const char *last, uint32 seed) -{ - return strecpy(buf, _name_romanian_real[SeedChance(0, lengthof(_name_romanian_real), seed)], last); -} - - -/** - * Generates Slovak town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeSlovakTownName(char *buf, const char *last, uint32 seed) -{ - return strecpy(buf, _name_slovak_real[SeedChance(0, lengthof(_name_slovak_real), seed)], last); -} - - -/** - * Generates Norwegian town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeNorwegianTownName(char *buf, const char *last, uint32 seed) -{ - /* Use first 4 bit from seed to decide whether or not this town should - * have a real name 3/16 chance. Bit 0-3 */ - if (SeedChance(0, 15, seed) < 3) { - /* Use 7bit for the realname table index. Bit 4-10 */ - return strecpy(buf, _name_norwegian_real[SeedChance(4, lengthof(_name_norwegian_real), seed)], last); - } - - /* Use 7bit for the first fake part. Bit 4-10 */ - buf = strecpy(buf, _name_norwegian_1[SeedChance(4, lengthof(_name_norwegian_1), seed)], last); - /* Use 7bit for the last fake part. Bit 11-17 */ - buf = strecpy(buf, _name_norwegian_2[SeedChance(11, lengthof(_name_norwegian_2), seed)], last); - - return buf; -} - - -/** - * Generates Hungarian town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeHungarianTownName(char *buf, const char *last, uint32 seed) -{ - if (SeedChance(12, 15, seed) < 3) { - return strecpy(buf, _name_hungarian_real[SeedChance(0, lengthof(_name_hungarian_real), seed)], last); - } - - /* optional first segment */ - uint i = SeedChance(3, lengthof(_name_hungarian_1) * 3, seed); - if (i < lengthof(_name_hungarian_1)) buf = strecpy(buf, _name_hungarian_1[i], last); - - /* mandatory middle segments */ - buf = strecpy(buf, _name_hungarian_2[SeedChance(3, lengthof(_name_hungarian_2), seed)], last); - buf = strecpy(buf, _name_hungarian_3[SeedChance(6, lengthof(_name_hungarian_3), seed)], last); - - /* optional last segment */ - i = SeedChance(10, lengthof(_name_hungarian_4) * 3, seed); - if (i < lengthof(_name_hungarian_4)) { - buf = strecpy(buf, _name_hungarian_4[i], last); - } - - return buf; -} - - -/** - * Generates Swiss town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeSwissTownName(char *buf, const char *last, uint32 seed) -{ - return strecpy(buf, _name_swiss_real[SeedChance(0, lengthof(_name_swiss_real), seed)], last); -} - - -/** - * Generates Danish town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeDanishTownName(char *buf, const char *last, uint32 seed) -{ - /* optional first segment */ - int i = SeedChanceBias(0, lengthof(_name_danish_1), seed, 50); - if (i >= 0) buf = strecpy(buf, _name_danish_1[i], last); - - /* middle segments removed as this algorithm seems to create much more realistic names */ - buf = strecpy(buf, _name_danish_2[SeedChance( 7, lengthof(_name_danish_2), seed)], last); - buf = strecpy(buf, _name_danish_3[SeedChance(16, lengthof(_name_danish_3), seed)], last); - - return buf; -} - - -/** - * Generates Turkish town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeTurkishTownName(char *buf, const char *last, uint32 seed) -{ - uint i = SeedModChance(0, 5, seed); - - switch (i) { - case 0: - buf = strecpy(buf, _name_turkish_prefix[SeedModChance( 2, lengthof(_name_turkish_prefix), seed)], last); - - /* middle segment */ - buf = strecpy(buf, _name_turkish_middle[SeedModChance( 4, lengthof(_name_turkish_middle), seed)], last); - - /* optional suffix */ - if (SeedModChance(0, 7, seed) == 0) { - buf = strecpy(buf, _name_turkish_suffix[SeedModChance( 10, lengthof(_name_turkish_suffix), seed)], last); - } - break; - - case 1: case 2: - buf = strecpy(buf, _name_turkish_prefix[SeedModChance( 2, lengthof(_name_turkish_prefix), seed)], last); - buf = strecpy(buf, _name_turkish_suffix[SeedModChance( 4, lengthof(_name_turkish_suffix), seed)], last); - break; - - default: - buf = strecpy(buf, _name_turkish_real[SeedModChance( 4, lengthof(_name_turkish_real), seed)], last); - break; - } - - return buf; -} - - -/** - * Generates Italian town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeItalianTownName(char *buf, const char *last, uint32 seed) -{ - if (SeedModChance(0, 6, seed) == 0) { // real city names - return strecpy(buf, _name_italian_real[SeedModChance(4, lengthof(_name_italian_real), seed)], last); - } - - static const char * const mascul_femin_italian[] = { - "o", - "a", - }; - - if (SeedModChance(0, 8, seed) == 0) { // prefix - buf = strecpy(buf, _name_italian_pref[SeedModChance(11, lengthof(_name_italian_pref), seed)], last); - } - - uint i = SeedChance(0, 2, seed); - if (i == 0) { // masculine form - buf = strecpy(buf, _name_italian_1m[SeedModChance(4, lengthof(_name_italian_1m), seed)], last); - } else { // feminine form - buf = strecpy(buf, _name_italian_1f[SeedModChance(4, lengthof(_name_italian_1f), seed)], last); - } - - if (SeedModChance(3, 3, seed) == 0) { - buf = strecpy(buf, _name_italian_2[SeedModChance(11, lengthof(_name_italian_2), seed)], last); - buf = strecpy(buf, mascul_femin_italian[i], last); - } else { - buf = strecpy(buf, _name_italian_2i[SeedModChance(16, lengthof(_name_italian_2i), seed)], last); - } - - if (SeedModChance(15, 4, seed) == 0) { - if (SeedModChance(5, 2, seed) == 0) { // generic suffix - buf = strecpy(buf, _name_italian_3[SeedModChance(4, lengthof(_name_italian_3), seed)], last); - } else { // river name suffix - buf = strecpy(buf, _name_italian_river1[SeedModChance(4, lengthof(_name_italian_river1), seed)], last); - buf = strecpy(buf, _name_italian_river2[SeedModChance(16, lengthof(_name_italian_river2), seed)], last); - } - } - - return buf; -} - - -/** - * Generates Catalan town name from given seed. - * @param buf output buffer - * @param seed town name seed - * @param last end of buffer - */ -static char *MakeCatalanTownName(char *buf, const char *last, uint32 seed) -{ - if (SeedModChance(0, 3, seed) == 0) { // real city names - return strecpy(buf, _name_catalan_real[SeedModChance(4, lengthof(_name_catalan_real), seed)], last); - } - - if (SeedModChance(0, 2, seed) == 0) { // prefix - buf = strecpy(buf, _name_catalan_pref[SeedModChance(11, lengthof(_name_catalan_pref), seed)], last); - } - - uint i = SeedChance(0, 2, seed); - if (i == 0) { // masculine form - buf = strecpy(buf, _name_catalan_1m[SeedModChance(4, lengthof(_name_catalan_1m), seed)], last); - buf = strecpy(buf, _name_catalan_2m[SeedModChance(11, lengthof(_name_catalan_2m), seed)], last); - } else { // feminine form - buf = strecpy(buf, _name_catalan_1f[SeedModChance(4, lengthof(_name_catalan_1f), seed)], last); - buf = strecpy(buf, _name_catalan_2f[SeedModChance(11, lengthof(_name_catalan_2f), seed)], last); - } - - if (SeedModChance(15, 5, seed) == 0) { - if (SeedModChance(5, 2, seed) == 0) { // generic suffix - buf = strecpy(buf, _name_catalan_3[SeedModChance(4, lengthof(_name_catalan_3), seed)], last); - } else { // river name suffix - buf = strecpy(buf, _name_catalan_river1[SeedModChance(4, lengthof(_name_catalan_river1), seed)], last); - } - } - - return buf; -} - - -typedef char *TownNameGenerator(char *buf, const char *last, uint32 seed); - -/** Contains pointer to generator and minimum buffer size (not incl. terminating '\0') */ -struct TownNameGeneratorParams { - byte min; ///< minimum number of characters that need to be printed for generator to work correctly - TownNameGenerator *proc; ///< generator itself -}; - -/** Town name generators */ -static const TownNameGeneratorParams _town_name_generators[] = { - { 4, MakeEnglishOriginalTownName}, // replaces first 4 characters of name - { 0, MakeFrenchTownName}, - { 0, MakeGermanTownName}, - { 4, MakeEnglishAdditionalTownName}, // replaces first 4 characters of name - { 0, MakeSpanishTownName}, - { 0, MakeSillyTownName}, - { 0, MakeSwedishTownName}, - { 0, MakeDutchTownName}, - { 8, MakeFinnishTownName}, // _name_finnish_1 - { 0, MakePolishTownName}, - { 0, MakeSlovakTownName}, - { 0, MakeNorwegianTownName}, - { 0, MakeHungarianTownName}, - { 0, MakeAustrianTownName}, - { 0, MakeRomanianTownName}, - { 28, MakeCzechTownName}, // _name_czech_adj + _name_czech_patmod + 1 + _name_czech_subst_stem + _name_czech_subst_postfix - { 0, MakeSwissTownName}, - { 0, MakeDanishTownName}, - { 0, MakeTurkishTownName}, - { 0, MakeItalianTownName}, - { 0, MakeCatalanTownName}, -}; - - -/** - * Generates town name from given seed. a language. - * @param buf output buffer - * @param last end of buffer - * @param lang town name language - * @param seed generation seed - * @return last character ('/0') - */ -char *GenerateTownNameString(char *buf, const char *last, size_t lang, uint32 seed) -{ - assert(lang < lengthof(_town_name_generators)); - - /* Some generators need at least 9 bytes in buffer. English generators need 5 for - * string replacing, others use constructions like strlen(buf)-3 and so on. - * Finnish generator needs to fit all strings from _name_finnish_1. - * Czech generator needs to fit almost whole town name... - * These would break. Using another temporary buffer results in ~40% slower code, - * so use it only when really needed. */ - const TownNameGeneratorParams *par = &_town_name_generators[lang]; - if (last >= buf + par->min) return par->proc(buf, last, seed); - - char *buffer = AllocaM(char, par->min + 1); - par->proc(buffer, buffer + par->min, seed); - - return strecpy(buf, buffer, last); -} diff --git a/src/namegen_func.h b/src/namegen_func.h deleted file mode 100644 index 7ce83fc41..000000000 --- a/src/namegen_func.h +++ /dev/null @@ -1,17 +0,0 @@ -/* $Id$ */ - -/* - * This file is part of OpenTTD. - * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. - * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . - */ - -/** @file namegen_func.h Town name generator stuff. */ - -#ifndef NAMEGEN_FUNC_H -#define NAMEGEN_FUNC_H - -char *GenerateTownNameString(char *buf, const char *last, size_t lang, uint32 seed); - -#endif /* NAMEGEN_FUNC_H */ diff --git a/src/saveload/oldloader_sl.cpp b/src/saveload/oldloader_sl.cpp index ee9216cdc..9b5303c0e 100644 --- a/src/saveload/oldloader_sl.cpp +++ b/src/saveload/oldloader_sl.cpp @@ -35,7 +35,7 @@ #include "table/strings.h" #include "../table/engines.h" -#include "../table/namegen.h" +#include "../table/townname.h" static bool _read_ttdpatch_flags; diff --git a/src/strings.cpp b/src/strings.cpp index 29fbfb41b..437619480 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -13,7 +13,7 @@ #include "openttd.h" #include "currency.h" #include "spritecache.h" -#include "namegen_func.h" +#include "townname_func.h" #include "station_base.h" #include "town.h" #include "screenshot.h" diff --git a/src/table/namegen.h b/src/table/namegen.h deleted file mode 100644 index 47c9ff05f..000000000 --- a/src/table/namegen.h +++ /dev/null @@ -1,3317 +0,0 @@ -/* $Id$ */ - -/* - * This file is part of OpenTTD. - * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. - * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . - */ - -/** @file table/namegen.h Namepart tables for the town name generator */ - -#include "../core/enum_type.hpp" - -static const char * const _name_original_english_1[] = { - "Great ", - "Little ", - "New ", - "Fort ", -}; - -static const char * const _name_original_english_2[] = { - "Wr", - "B", - "C", - "Ch", - "Br", - "D", - "Dr", - "F", - "Fr", - "Fl", - "G", - "Gr", - "H", - "L", - "M", - "N", - "P", - "Pr", - "Pl", - "R", - "S", - "S", - "Sl", - "T", - "Tr", - "W", -}; - -static const char * const _name_original_english_3[] = { - "ar", - "a", - "e", - "in", - "on", - "u", - "un", - "en", -}; - -static const char * const _name_original_english_4[] = { - "n", - "ning", - "ding", - "d", - "", - "t", - "fing", -}; - -static const char * const _name_original_english_5[] = { - "ville", - "ham", - "field", - "ton", - "town", - "bridge", - "bury", - "wood", - "ford", - "hall", - "ston", - "way", - "stone", - "borough", - "ley", - "head", - "bourne", - "pool", - "worth", - "hill", - "well", - "hattan", - "burg", -}; - -static const char * const _name_original_english_6[] = { - "-on-sea", - " Bay", - " Market", - " Cross", - " Bridge", - " Falls", - " City", - " Ridge", - " Springs", -}; - -static const char * const _name_additional_english_prefix[] = { - "Great ", - "Little ", - "New ", - "Fort ", - "St. ", - "Old ", -}; - -static const char * const _name_additional_english_1a[] = { - "Pen", - "Lough", - "Stam", - "Aber", - "Acc", - "Ex", - "Ax", - "Bre", - "Cum", - "Dun", - "Fin", - "Inver", - "Kin", - "Mon", - "Nan", - "Nant", - "Pit", - "Pol", - "Pont", - "Strath", - "Tre", - "Tilly", - "Beck", - "Canter", - "Bath", - "Liver", - "Mal", - "Ox", - "Bletch", - "Maccles", - "Grim", - "Wind", - "Sher", - "Gates", - "Orp", - "Brom", - "Lewis", - "Whit", - "White", - "Worm", - "Tyne", - "Avon", - "Stan", -}; - -static const char * const _name_additional_english_1b1[] = { - "Wr", - "B", - "C", - "Ch", - "Br", - "D", - "Dr", - "F", - "Fr", - "Fl", - "G", - "Gr", - "H", - "L", - "M", - "N", - "P", - "Pr", - "Pl", - "R", - "S", - "S", - "Sl", - "T", - "Tr", - "W", -}; - -static const char * const _name_additional_english_1b2[] = { - "ar", - "a", - "e", - "in", - "on", - "u", - "o", - "ee", - "es", - "ea", - "un", - "en", -}; - -static const char * const _name_additional_english_1b3a[] = { - "n", - "d", - "", - "t", - "", - "", -}; - -static const char * const _name_additional_english_1b3b[] = { - "ning", - "ding", - "fing", -}; - -static const char * const _name_additional_english_2[] = { - "ville", - "ham", - "field", - "ton", - "town", - "borough", - "bridge", - "bury", - "wood", - "ditch", - "ford", - "hall", - "dean", - "leigh", - "dore", - "ston", - "stow", - "church", - "wich", - "low", - "way", - "stone", - "minster", - "ley", - "head", - "bourne", - "pool", - "worth", - "hill", - "well", - "hattan", - "burg", - "berg", - "burgh", - "port", - "stoke", - "haven", - "stable", - "stock", - "side", - "brook", - "don", - "den", - "down", - "nor", - "grove", - "combe", - "by", - "say", - "ney", - "chester", - "dale", - "ness", - "shaw", - "thwaite", -}; - -static const char * const _name_additional_english_3[] = { - "-on-sea", - " Bay", - " Market", - " Beeches", - " Common", - " Park", - " Heath", - " Marsh", - " Green", - " Castle", - " End", - " Rivers", - " Cross", - " Bridge", - " Falls", - " City", - " Ridge", - " Springs", -}; - -static const char * const _name_austrian_a1[] = { - "Bad ", - "Deutsch ", - "Gross ", - "Klein ", - "Markt ", - "Maria ", -}; - -static const char * const _name_austrian_a2[] = { - "Aus", - "Alten", - "Braun", - "V\xC3\xB6sl", - "Mittern", - "Nuss", - "Neu", - "Walters", - "Breiten", - "Eisen", - "Feld", - "Mittern", - "Gall", - "Obern", - "Grat", - "Heiligen", - "Hof", - "Holla", - "Stein", - "Eber", - "Eggen", - "Enzers", - "Frauen", - "Herren", - "Hof", - "H\xC3\xBCtt", - "Kaisers", - "K\xC3\xB6nigs", - "Knittel", - "Lang", - "Ober", - "Ollers", - "Pfaffen", - "Potten", - "Salz", - "Schwarz", - "Stocker", - "Unter", - "Utten", - "V\xC3\xB6sen", - "Vill", - "Weissen", -}; - -static const char * const _name_austrian_a3[] = { - "see", - "bach", - "dorf", - "ach", - "stein", - "hofen", - "au", - "ach", - "kirch", - "kirchen", - "kreuz", - "brunn", - "siedl", - "markt", - "wang", - "haag", -}; - -static const char * const _name_austrian_a4[] = { - "Bruck", - "Brunn", - "Gams", - "Grein", - "Ried", - "Faak", - "Zell", - "Spital", - "Kirchberg", - "Saal", - "Taferl", - "Wald", -}; - -static const char * const _name_austrian_a5[] = { - "St. ", - "Sankt ", -}; - -static const char * const _name_austrian_a6[] = { - "Aegyd", - "Andr\xC3\xA4", - "Georgen", - "Jakob", - "Johann", - "Leonhard", - "Marein", - "Lorenzen", - "Margarethen", - "Martin", - "Michael", - "Nikolai", - "Oswald", - "Peter", - "P\xC3\xB6lten", - "Stefan", - "Stephan", - "Thomas", - "Veit", - "Wolfgang", -}; - -static const char * const _name_austrian_f1[] = { - " an der ", - " ob der ", -}; - -static const char * const _name_austrian_f2[] = { - "Donau", - "Steyr", - "Lafnitz", - "Leitha", - "Thaya", - "Gail", - "Drau", - "Salzach", - "Ybbs", - "Traisen", - "Enns", - "Mur", - "Ill", -}; - -static const char * const _name_austrian_b1[] = { - " am ", -}; - -static const char * const _name_austrian_b2[] = { - "Brenner", - "Dachstein", - "Gebirge", - "Grossglockner", - "Hausruck", - "Semmering", - "Wagram", - "Wechsel", - "Wilden Kaiser", - "Ziller", -}; - -static const char * const _name_german_real[] = { - "Berlin", - "Bonn", - "Bremen", - "Cottbus", - "Chemnitz", - "Dortmund", - "Dresden", - "Erfurt", - "Erlangen", - "Essen", - "Fulda", - "Gera", - "Kassel", - "Kiel", - "K\xC3\xB6ln", - "L\xC3\xBC""beck", - "Magdeburg", - "M\xC3\xBCnchen", - "Potsdam", - "Stuttgart", - "Wiesbaden", -}; - -static const char * const _name_german_pre[] = { - "Bad ", - "Klein ", - "Neu ", -}; - -static const char * const _name_german_1[] = { - "Alb", - "Als", - "Ander", - "Arns", - "Bruns", - "Bam", - "Biele", - "Cloppen", - "Co", - "Duis", - "D\xC3\xBCssel", - "Dannen", - "Elb", - "Els", - "Elster", - "Eichen", - "Ems", - "Fahr", - "Falken", - "Flens", - "Frank", - "Frei", - "Freuden", - "Fried", - "F\xC3\xBCrsten", - "Hahn", - "Ham", - "Harz", - "Heidel", - "Hers", - "Herz", - "Holz", - "Hildes", - "Inns", - "Ilsen", - "Ingols", - "Kel", - "Kies", - "Korn", - "Kor", - "Kreuz", - "Kulm", - "Langen", - "Lim", - "Lohr", - "L\xC3\xBCne", - "Mel", - "Michels", - "M\xC3\xBChl", - "Naum", - "Nest", - "Nord", - "Nort", - "Nien", - "Nidda", - "Nieder", - "N\xC3\xBCrn", - "Ober", - "Offen", - "Osna", - "Olden", - "Ols", - "Oranien", - "Pader", - "Quedlin", - "Quer", - "Ravens", - "Regens", - "Rott", - "Ros", - "R\xC3\xBCssels", - "Saal", - "Saar", - "Salz", - "Sch\xC3\xB6ne", - "Schwein", - "Sonder", - "Sonnen", - "Stein", - "Strals", - "Straus", - "S\xC3\xBC""d", - "Ton", - "Unter", - "Ur", - "Vor", - "Wald", - "War", - "Wert", - "Wester", - "Witten", - "Wolfs", - "W\xC3\xBCrz", -}; - -static const char * const _name_german_2[] = { - "bach", - "berg", - "br\xC3\xBC""ck", - "br\xC3\xBC""cken", - "burg", - "dorf", - "feld", - "furt", - "hausen", - "haven", - "heim", - "horst", - "mund", - "m\xC3\xBCnster", - "stadt", - "wald", -}; - -static const char * const _name_german_3_an_der[] = { - " an der ", -}; - -static const char * const _name_german_3_am[] = { - " am ", -}; - -static const char * const _name_german_4_an_der[] = { - "Oder", - "Spree", - "Donau", - "Saale", - "Elbe", -}; - -static const char * const _name_german_4_am[] = { - "Main", -}; - -static const char * const _name_spanish_real[] = { - "Caracas", - "Maracay", - "Maracaibo", - "Valencia", - "El Dorado", - "Morrocoy", - "Cata", - "Cataito", - "Ciudad Bolivar", - "Barquisimeto", - "Merida", - "Puerto Ordaz", - "Santa Elena", - "San Juan", - "San Luis", - "San Rafael", - "Santiago", - "Barcelona", - "Barinas", - "San Cristobal", - "San Fransisco", - "San Martin", - "Guayana", - "San Carlos", - "El Limon", - "Coro", - "Corocoro", - "Puerto Ayacucho", - "Elorza", - "Arismendi", - "Trujillo", - "Carupano", - "Anaco", - "Lima", - "Cuzco", - "Iquitos", - "Callao", - "Huacho", - "Camana", - "Puerto Chala", - "Santa Cruz", - "Quito", - "Cuenca", - "Huacho", - "Tulcan", - "Esmeraldas", - "Ibarra", - "San Lorenzo", - "Macas", - "Morana", - "Machala", - "Zamora", - "Latacunga", - "Tena", - "Cochabamba", - "Ascension", - "Magdalena", - "Santa Ana", - "Manoa", - "Sucre", - "Oruro", - "Uyuni", - "Potosi", - "Tupiza", - "La Quiaca", - "Yacuiba", - "San Borja", - "Fuerte Olimpio", - "Fortin Esteros", - "Campo Grande", - "Bogota", - "El Banco", - "Zaragoza", - "Neiva", - "Mariano", - "Cali", - "La Palma", - "Andoas", - "Barranca", - "Montevideo", - "Valdivia", - "Arica", - "Temuco", - "Tocopilla", - "Mendoza", - "Santa Rosa", -}; - -static const char * const _name_french_real[] = { - "Agincourt", - "Lille", - "Dinan", - "Aubusson", - "Rodez", - "Bergerac", - "Bordeaux", - "Bayonne", - "Montpellier", - "Mont\xC3\xA9limar", - "Valence", - "Digne", - "Nice", - "Cannes", - "St. Tropez", - "Marseille", - "Narbonne", - "S\xC3\xA8te", - "Aurillac", - "Gu\xC3\xA9ret", - "Le Creusot", - "Nevers", - "Auxerre", - "Versailles", - "Meaux", - "Ch\xC3\xA2lons", - "Compi\xC3\xA8gne", - "Metz", - "Chaumont", - "Langres", - "Bourg", - "Lyon", - "Vienne", - "Grenoble", - "Toulon", - "Rennes", - "Le Mans", - "Angers", - "Nantes", - "Ch\xC3\xA2teauroux", - "Orl\xC3\xA9""ans", - "Lisieux", - "Cherbourg", - "Morlaix", - "Cognac", - "Agen", - "Tulle", - "Blois", - "Troyes", - "Charolles", - "Grenoble", - "Chamb\xC3\xA9ry", - "Tours", - "St. Brieuc", - "St. Malo", - "La Rochelle", - "St. Flour", - "Le Puy", - "Vichy", - "St. Valery", - "Beaujolais", - "Narbonne", - "Albi", - "Paris", - "Biarritz", - "B\xC3\xA9ziers", - "N\xC3\xAEmes", - "Chamonix", - "Angoul\xC3\xA8me", - "Alen\xC3\xA7on", -}; - -static const char * const _name_silly_1[] = { - "Binky", - "Blubber", - "Bumble", - "Crinkle", - "Crusty", - "Dangle", - "Dribble", - "Flippety", - "Google", - "Muffin", - "Nosey", - "Pinker", - "Quack", - "Rumble", - "Sleepy", - "Sliggles", - "Snooze", - "Teddy", - "Tinkle", - "Twister", - "Pinker", - "Hippo", - "Itchy", - "Jelly", - "Jingle", - "Jolly", - "Kipper", - "Lazy", - "Frogs", - "Mouse", - "Quack", - "Cheeky", - "Lumpy", - "Grumpy", - "Mangle", - "Fiddle", - "Slugs", - "Noodles", - "Poodles", - "Shiver", - "Rumble", - "Pixie", - "Puddle", - "Riddle", - "Rattle", - "Rickety", - "Waffle", - "Sagging", - "Sausage", - "Egg", - "Sleepy", - "Scatter", - "Scramble", - "Silly", - "Simple", - "Trickle", - "Slippery", - "Slimey", - "Slumber", - "Soggy", - "Sliggles", - "Splutter", - "Sulky", - "Swindle", - "Swivel", - "Tasty", - "Tangle", - "Toggle", - "Trotting", - "Tumble", - "Snooze", - "Water", - "Windy", - "Amble", - "Bubble", - "Cheery", - "Cheese", - "Cockle", - "Cracker", - "Crumple", - "Teddy", - "Evil", - "Fairy", - "Falling", - "Fishy", - "Fizzle", - "Frosty", - "Griddle", -}; - -static const char * const _name_silly_2[] = { - "ton", - "bury", - "bottom", - "ville", - "well", - "weed", - "worth", - "wig", - "wick", - "wood", - "pool", - "head", - "burg", - "gate", - "bridge", -}; - -static const char * const _name_swedish_1[] = { - "Gamla ", - "Lilla ", - "Nya ", - "Stora ", -}; - -static const char * const _name_swedish_2[] = { - "Boll", - "Bor", - "Ed", - "En", - "Erik", - "Es", - "Fin", - "Fisk", - "Gr\xC3\xB6n", - "Hag", - "Halm", - "Karl", - "Kram", - "Kung", - "Land", - "Lid", - "Lin", - "Mal", - "Malm", - "Marie", - "Ner", - "Norr", - "Oskar", - "Sand", - "Skog", - "Stock", - "Stor", - "Str\xC3\xB6m", - "Sund", - "S\xC3\xB6""der", - "Tall", - "Tratt", - "Troll", - "Upp", - "Var", - "V\xC3\xA4ster", - "\xC3\x84ngel", - "\xC3\x96ster", -}; - -static const char * const _name_swedish_2a[] = { - "B", - "Br", - "D", - "Dr", - "Dv", - "F", - "Fj", - "Fl", - "Fr", - "G", - "Gl", - "Gn", - "Gr", - "H", - "J", - "K", - "Kl", - "Kn", - "Kr", - "Kv", - "L", - "M", - "N", - "P", - "Pl", - "Pr", - "R", - "S", - "Sk", - "Skr", - "Sl", - "Sn", - "Sp", - "Spr", - "St", - "Str", - "Sv", - "T", - "Tr", - "Tv", - "V", - "Vr", -}; - -static const char * const _name_swedish_2b[] = { - "a", - "e", - "i", - "o", - "u", - "y", - "\xC3\xA5", - "\xC3\xA4", - "\xC3\xB6", -}; - -static const char * const _name_swedish_2c[] = { - "ck", - "d", - "dd", - "g", - "gg", - "l", - "ld", - "m", - "n", - "nd", - "ng", - "nn", - "p", - "pp", - "r", - "rd", - "rk", - "rp", - "rr", - "rt", - "s", - "sk", - "st", - "t", - "tt", - "v", -}; - -static const char * const _name_swedish_3[] = { - "arp", - "berg", - "boda", - "borg", - "bro", - "bukten", - "by", - "byn", - "fors", - "hammar", - "hamn", - "holm", - "hus", - "h\xC3\xA4ttan", - "kulle", - "k\xC3\xB6ping", - "lund", - "l\xC3\xB6v", - "sala", - "skrona", - "sl\xC3\xA4tt", - "sp\xC3\xA5ng", - "stad", - "sund", - "svall", - "svik", - "s\xC3\xA5ker", - "udde", - "valla", - "viken", - "\xC3\xA4lv", - "\xC3\xA5s", -}; - -static const char * const _name_dutch_1[] = { - "Nieuw ", - "Oud ", - "Groot ", - "Zuid ", - "Noord ", - "Oost ", - "West ", - "Klein ", -}; - -static const char * const _name_dutch_2[] = { - "Hoog", - "Laag", - "Zuider", - "Zuid", - "Ooster", - "Oost", - "Wester", - "West", - "Hoofd", - "Midden", - "Eind", - "Amster", - "Amstel", - "Dord", - "Rotter", - "Haar", - "Til", - "Enk", - "Dok", - "Veen", - "Leidsch", - "Lely", - "En", - "Kaats", - "U", - "Maas", - "Mar", - "Bla", - "Al", - "Alk", - "Eer", - "Drie", - "Ter", - "Groes", - "Goes", - "Soest", - "Coe", - "Uit", - "Zwaag", - "Hellen", - "Slie", - "IJ", - "Grubben", - "Groen", - "Lek", - "Ridder", - "Schie", - "Olde", - "Roose", - "Haar", - "Til", - "Loos", - "Hil", -}; - -static const char * const _name_dutch_3[] = { - "Drog", - "Nat", - "Valk", - "Bob", - "Dedem", - "Kollum", - "Best", - "Hoend", - "Leeuw", - "Graaf", - "Uithuis", - "Purm", - "Hard", - "Hell", - "Werk", - "Spijk", - "Vink", - "Wams", - "Heerhug", - "Koning", -}; - -static const char * const _name_dutch_4[] = { - "e", - "er", - "el", - "en", - "o", - "s", -}; - -static const char * const _name_dutch_5[] = { - "stad", - "vorst", - "dorp", - "dam", - "beek", - "doorn", - "zijl", - "zijlen", - "lo", - "muiden", - "meden", - "vliet", - "nisse", - "daal", - "vorden", - "vaart", - "mond", - "zaal", - "water", - "duinen", - "heuvel", - "geest", - "kerk", - "meer", - "maar", - "hoorn", - "rade", - "wijk", - "berg", - "heim", - "sum", - "richt", - "burg", - "recht", - "drecht", - "trecht", - "tricht", - "dricht", - "lum", - "rum", - "halen", - "oever", - "wolde", - "veen", - "hoven", - "gast", - "kum", - "hage", - "dijk", - "zwaag", - "pomp", - "huizen", - "bergen", - "schede", - "mere", - "end", -}; - -static const char * const _name_finnish_real[] = { - "Aijala", - "Kisko", - "Espoo", - "Helsinki", - "Tapiola", - "J\xC3\xA4rvel\xC3\xA4", - "Lahti", - "Kotka", - "Hamina", - "Loviisa", - "Kouvola", - "Tampere", - "Oulu", - "Salo", - "Malmi", - "Pelto", - "Koski", - "Iisalmi", - "Raisio", - "Taavetti", - "Joensuu", - "Imatra", - "Tapanila", - "Pasila", - "Turku", - "Kupittaa", - "Vaasa", - "Pori", - "Rauma", - "Kolari", - "Lieksa", -}; - -static const char * const _name_finnish_1[] = { - "Hiekka", - "Haapa", - "Mylly", - "Sauna", - "Uusi", - "Vanha", - "Kes\xC3\xA4", - "Kuusi", - "Pelto", - "Tuomi", - "Terva", - "Olki", - "Hein\xC3\xA4", - "Sein\xC3\xA4", - "Rova", - "Koivu", - "Kokko", - "M\xC3\xA4nty", - "Pihlaja", - "Pet\xC3\xA4j\xC3\xA4", - "Kielo", - "Kauha", - "Viita", - "Kivi", - "Riihi", - "\xC3\x84\xC3\xA4ne", - "Niini", -}; - -static const char * const _name_finnish_2[] = { - "Lappeen", - "Lohjan", - "Savon", - "Lapin", - "Pit\xC3\xA4j\xC3\xA4n", - "Martin", - "Kuusan", - "Kemi", - "Keri", - "H\xC3\xA4meen", - "Kangas", -}; - -static const char * const _name_finnish_3[] = { - "harju", - "linna", - "j\xC3\xA4rvi", - "kallio", - "m\xC3\xA4ki", - "nummi", - "joki", - "kyl\xC3\xA4", - "lampi", - "lahti", - "mets\xC3\xA4", - "suo", - "laakso", - "niitty", - "luoto", - "hovi", - "ranta", - "koski", - "salo", -}; - -static const char * const _name_polish_1_m[] = { - "Wielki ", - "Ma\xC5\x82y ", - "Z\xC5\x82y ", - "Dobry ", - "Nowy ", - "Stary ", - "Z\xC5\x82oty ", - "Zielony ", - "Bia\xC5\x82y ", - "Modry ", - "D\xC4\x99""bowy ", -}; - -static const char * const _name_polish_1_f[] = { - "Wielka ", - "Ma\xC5\x82""a ", - "Z\xC5\x82""a ", - "Dobra ", - "Nowa ", - "Stara ", - "Z\xC5\x82ota ", - "Zielona ", - "Bia\xC5\x82""a ", - "Modra ", - "D\xC4\x99""bowa ", -}; - -static const char * const _name_polish_1_n[] = { - "Wielkie ", - "Ma\xC5\x82""e ", - "Z\xC5\x82""e ", - "Dobre ", - "Nowe ", - "Stare ", - "Z\xC5\x82ote ", - "Zielone ", - "Bia\xC5\x82""e ", - "Modre ", - "D\xC4\x99""bowe ", -}; - -static const char * const _name_polish_2_o[] = { - "Frombork", - "Gniezno", - "Olsztyn", - "Toru\xC5\x84", - "Bydgoszcz", - "Terespol", - "Krak\xC3\xB3w", - "Pozna\xC5\x84", - "Wroc\xC5\x82""aw", - "Katowice", - "Cieszyn", - "Bytom", - "Frombork", - "Hel", - "Konin", - "Lublin", - "Malbork", - "Sopot", - "Sosnowiec", - "Gda\xC5\x84sk", - "Gdynia", - "Sieradz", - "Sandomierz", - "Szczyrk", - "Szczytno", - "Szczecin", - "Zakopane", - "Szklarska Por\xC4\x99""ba", - "Bochnia", - "Golub-Dobrzyn", - "Chojnice", - "Ostrowiec", - "Otwock", - "Wolsztyn", -}; - -static const char * const _name_polish_2_m[] = { - "Jarocin", - "Gogolin", - "Tomasz\xC3\xB3w", - "Piotrk\xC3\xB3w", - "Lidzbark", - "Rypin", - "Radzymin", - "Wo\xC5\x82omin", - "Pruszk\xC3\xB3w", - "Olsztynek", - "Rypin", - "Cisek", - "Krotoszyn", - "Stoczek", - "Lubin", - "Lubicz", - "Milicz", - "Targ", - "Ostr\xC3\xB3w", - "Ozimek", - "Puck", - "Rzepin", - "Siewierz", - "Stargard", - "Starogard", - "Turek", - "Tymbark", - "Wolsztyn", - "Strzepcz", - "Strzebielin", - "Sochaczew", - "Gr\xC4\x99""bocin", - "Gniew", - "Lubliniec", - "Lubasz", - "Lutomiersk", - "Niemodlin", - "Przeworsk", - "Ursus", - "Tyczyn", - "Sztum", - "Szczebrzeszyn", - "Wolin", - "Wrzeszcz", - "Zgierz", - "Zieleniec", - "Drobin", - "Garwolin", -}; - -static const char * const _name_polish_2_f[] = { - "Szprotawa", - "Pogorzelica", - "Mot\xC5\x82""awa", - "Lubawa", - "Nidzica", - "Kruszwica", - "Bierawa", - "Brodnica", - "Chojna", - "Krzepica", - "Ruda", - "Rumia", - "Tuchola", - "Trzebinia", - "Ustka", - "Warszawa", - "Bobowa", - "Dukla", - "Krynica", - "Murowana", - "Niemcza", - "Zaspa", - "Zawoja", - "Wola", - "Limanowa", - "Rabka", - "Skawina", - "Pilawa", -}; - -static const char * const _name_polish_2_n[] = { - "Lipsko", - "Pilzno", - "Przodkowo", - "Strzelno", - "Susz", - "Jaworzno", - "Choszczno", - "Mogilno", - "Luzino", - "Miasto", - "Dziadowo", - "Kowalewo", - "Legionowo", - "Miastko", - "Zabrze", - "Zawiercie", - "Kochanowo", - "Miechucino", - "Mirachowo", - "Robakowo", - "Kosakowo", - "Borne", - "Braniewo", - "Sulinowo", - "Chmielno", - "Jastrz\xC4\x99""bie", - "Gryfino", - "Koronowo", - "Lubichowo", - "Opoczno", -}; - -static const char * const _name_polish_3_m[] = { - " Wybudowanie", - " \xC5\x9Awi\xC4\x99tokrzyski", - " G\xC3\xB3rski", - " Morski", - " Zdr\xC3\xB3j", - " Wody", - " Bajoro", - " Kraje\xC5\x84ski", - " \xC5\x9Al\xC4\x85ski", - " Mazowiecki", - " Pomorski", - " Wielki", - " Maly", - " Warmi\xC5\x84ski", - " Mazurski", - " Mniejszy", - " Wi\xC4\x99kszy", - " G\xC3\xB3rny", - " Dolny", - " Wielki", - " Stary", - " Nowy", - " Wielkopolski", - " Wzg\xC3\xB3rze", - " Mosty", - " Kujawski", - " Ma\xC5\x82opolski", - " Podlaski", - " Lesny", -}; - -static const char * const _name_polish_3_f[] = { - " Wybudowanie", - " \xC5\x9Awi\xC4\x99tokrzyska", - " G\xC3\xB3rska", - " Morska", - " Zdr\xC3\xB3j", - " Woda", - " Bajoro", - " Kraje\xC5\x84ska", - " \xC5\x9Al\xC4\x85ska", - " Mazowiecka", - " Pomorska", - " Wielka", - " Ma\xC5\x82""a", - " Warmi\xC5\x84ska", - " Mazurska", - " Mniejsza", - " Wi\xC4\x99ksza", - " G\xC3\xB3rna", - " Dolna", - " Wielka", - " Stara", - " Nowa", - " Wielkopolska", - " Wzg\xC3\xB3rza", - " Mosty", - " Kujawska", - " Malopolska", - " Podlaska", - " Le\xC5\x9Bna", -}; - -static const char * const _name_polish_3_n[] = { - " Wybudowanie", - " \xC5\x9Awietokrzyskie", - " G\xC3\xB3rskie", - " Morskie", - " Zdr\xC3\xB3j", - " Wody", - " Bajoro", - " Kraje\xC5\x84skie", - " \xC5\x9Al\xC4\x85skie", - " Mazowieckie", - " Pomorskie", - " Wielkie", - " Ma\xC5\x82""e", - " Warmi\xC5\x84skie ", - " Mazurskie ", - " Mniejsze", - " Wi\xC4\x99ksze", - " G\xC3\xB3rne", - " Dolne", - " Wielkie", - " Stare", - " Nowe", - " Wielkopolskie", - " Wzg\xC3\xB3rze", - " Mosty", - " Kujawskie", - " Ma\xC5\x82opolskie", - " Podlaskie", - " Le\xC5\x9Bne", -}; - -static const char * const _name_czech_real[] = { - "A\xC5\xA1", - "Bene\xC5\xA1ov", - "Beroun", - "Bezdru\xC5\xBEice", - "Blansko", - "B\xC5\x99""eclav", - "Brno", - "Brunt\xC3\xA1l", - "\xC4\x8C""esk\xC3\xA1 L\xC3\xADpa", - "\xC4\x8C""esk\xC3\xA9 Bud\xC4\x9Bjovice", - "\xC4\x8C""esk\xC3\xBD Krumlov", - "D\xC4\x9B\xC4\x8D\xC3\xADn", - "Doma\xC5\xBElice", - "Dub\xC3\xAD", - "Fr\xC3\xBD""dek-M\xC3\xADstek", - "Havl\xC3\xAD\xC4\x8Dk\xC5\xAFv Brod", - "Hodon\xC3\xADn", - "Hradec Kr\xC3\xA1lov\xC3\xA9", - "Humpolec", - "Cheb", - "Chomutov", - "Chrudim", - "Jablonec nad Nisou", - "Jesen\xC3\xADk", - "Ji\xC4\x8D\xC3\xADn", - "Jihlava", - "Jind\xC5\x99ich\xC5\xAFv Hradec", - "Karlovy Vary", - "Karvin\xC3\xA1", - "Kladno", - "Klatovy", - "Kol\xC3\xADn", - "Kosmonosy", - "Krom\xC4\x9B\xC5\x99\xC3\xAD\xC5\xBE", - "Kutn\xC3\xA1 Hora", - "Liberec", - "Litom\xC4\x9B\xC5\x99ice", - "Louny", - "Man\xC4\x9Bt\xC3\xADn", - "M\xC4\x9Bln\xC3\xADk", - "Mlad\xC3\xA1 Boleslav", - "Most", - "N\xC3\xA1""chod", - "Nov\xC3\xBD Ji\xC4\x8D\xC3\xADn", - "Nymburk", - "Olomouc", - "Opava", - "Or\xC3\xA1\xC4\x8Dov", - "Ostrava", - "Pardubice", - "Pelh\xC5\x99imov", - "Pol\xC5\xBEice", - "P\xC3\xADsek", - "Plze\xC5\x88", - "Praha", - "Prachatice", - "P\xC5\x99""erov", - "P\xC5\x99\xC3\xAD""bram", - "Prost\xC4\x9Bjov", - "Rakovn\xC3\xADk", - "Rokycany", - "Rudn\xC3\xA1", - "Rychnov nad Kn\xC4\x9B\xC5\xBEnou", - "Semily", - "Sokolov", - "Strakonice", - "St\xC5\x99""edokluky", - "\xC5\xA0umperk", - "Svitavy", - "T\xC3\xA1""bor", - "Tachov", - "Teplice", - "T\xC5\x99""eb\xC3\xAD\xC4\x8D", - "Trutnov", - "Uhersk\xC3\xA9 Hradi\xC5\xA1t\xC4\x9B", - "\xC3\x9Ast\xC3\xAD nad Labem", - "\xC3\x9Ast\xC3\xAD nad Orlic\xC3\xAD", - "Vset\xC3\xADn", - "Vy\xC5\xA1kov", - "\xC5\xBD\xC4\x8F\xC3\xA1r nad S\xC3\xA1zavou", - "Zl\xC3\xADn", - "Znojmo", -}; - - -/* The advanced hyperintelligent Czech town names generator! - * The tables and MakeCzechTownName() is (c) Petr Baudis 2005 (GPL'd) - * Feel free to ask me about anything unclear or if you need help - * with cloning this for your own language. */ - -/* Sing., pl. */ -enum CzechGender { - CZG_SMASC, - CZG_SFEM, - CZG_SNEUT, - CZG_PMASC, - CZG_PFEM, - CZG_PNEUT, - /* Special for substantive stems - the ending chooses the gender. */ - CZG_FREE, - /* Like CZG_FREE, but disallow CZG_SNEUT. */ - CZG_NFREE -}; - -enum CzechPattern { - CZP_JARNI, - CZP_MLADY, - CZP_PRIVL -}; - -/* [CzechGender][CzechPattern] - replaces the last character of the adjective - * by this. - * XXX: [CZG_SMASC][CZP_PRIVL] needs special handling: -ovX -> -uv. */ -static const char * const _name_czech_patmod[][3] = { - /* CZG_SMASC */ { "\xC3\xAD", "\xC3\xBD", "X" }, - /* CZG_SFEM */ { "\xC3\xAD", "\xC3\xA1", "a" }, - /* CZG_SNEUT */ { "\xC3\xAD", "\xC3\xA9", "o" }, - /* CZG_PMASC */ { "\xC3\xAD", "\xC3\xA9", "y" }, - /* CZG_PFEM */ { "\xC3\xAD", "\xC3\xA9", "y" }, - /* CZG_PNEUT */ { "\xC3\xAD", "\xC3\xA1", "a" } -}; - -/* This way the substantives can choose only some adjectives/endings: - * At least one of these flags must be satisfied: */ -enum CzechAllow { - CZA_SHORT = 1, - CZA_MIDDLE = 2, - CZA_LONG = 4, - CZA_ALL = ~0 -}; - -DECLARE_ENUM_AS_BIT_SET(CzechAllow); - -/* All these flags must be satisfied (in the stem->others direction): */ -enum CzechChoose { - CZC_NONE = 0, // No requirements. - CZC_COLOR = 1, - CZC_POSTFIX = 2, // Matched if postfix was inserted. - CZC_NOPOSTFIX = 4, // Matched if no postfix was inserted. - CZC_ANY = ~0 -}; - -DECLARE_ENUM_AS_BIT_SET(CzechChoose); - -struct CzechNameSubst { - CzechGender gender; - CzechAllow allow; - CzechChoose choose; - const char *name; -}; - -struct CzechNameAdj { - CzechPattern pattern; - CzechChoose choose; - const char *name; -}; - -/* Some of items which should be common are doubled. */ -static const CzechNameAdj _name_czech_adj[] = { - { CZP_JARNI, CZC_ANY, "Horn\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "Horn\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "Doln\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "Doln\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "P\xC5\x99""edn\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "Zadn\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "Kosteln\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "Havran\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "\xC5\x98\xC3\xAD\xC4\x8Dn\xC3\xAD" }, - { CZP_JARNI, CZC_ANY, "Jezern\xC3\xAD" }, - { CZP_MLADY, CZC_ANY, "Velk\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Velk\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Mal\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Mal\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Vysok\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "\xC4\x8C""esk\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Moravsk\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Slov\xC3\xA1""ck\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Slezsk\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Uhersk\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Star\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Star\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Nov\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Nov\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Mlad\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Kr\xC3\xA1lovsk\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Kamenn\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Cihlov\xC3\xBD" }, - { CZP_MLADY, CZC_ANY, "Divn\xC3\xBD" }, - { CZP_MLADY, CZC_COLOR, "\xC4\x8C""erven\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "\xC4\x8C""erven\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "\xC4\x8C""erven\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "Zelen\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "\xC5\xBDlut\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "Siv\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "\xC5\xA0""ed\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "B\xC3\xADl\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "B\xC3\xADl\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "Modr\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "R\xC5\xAF\xC5\xBEov\xC3\xA1" }, - { CZP_MLADY, CZC_COLOR, "\xC4\x8C""ern\xC3\xA1" }, - { CZP_PRIVL, CZC_ANY, "Kr\xC3\xA1lova" }, - { CZP_PRIVL, CZC_ANY, "Janova" }, - { CZP_PRIVL, CZC_ANY, "Karlova" }, - { CZP_PRIVL, CZC_ANY, "Kry\xC5\xA1tofova" }, - { CZP_PRIVL, CZC_ANY, "Ji\xC5\x99\xC3\xADkova" }, - { CZP_PRIVL, CZC_ANY, "Petrova" }, - { CZP_PRIVL, CZC_ANY, "Sudovo" }, -}; - -/* Considered a stem for choose/allow matching purposes. */ -static const CzechNameSubst _name_czech_subst_full[] = { - { CZG_SMASC, CZA_ALL, CZC_COLOR, "Sedlec" }, - { CZG_SMASC, CZA_ALL, CZC_COLOR, "Brod" }, - { CZG_SMASC, CZA_ALL, CZC_COLOR, "Brod" }, - { CZG_SMASC, CZA_ALL, CZC_NONE, "\xC3\x9Aval" }, - { CZG_SMASC, CZA_ALL, CZC_COLOR, "\xC5\xBD\xC4\x8F\xC3\xA1r" }, - { CZG_SMASC, CZA_ALL, CZC_COLOR, "Smrk" }, - { CZG_SFEM, CZA_ALL, CZC_COLOR, "Hora" }, - { CZG_SFEM, CZA_ALL, CZC_COLOR, "Lhota" }, - { CZG_SFEM, CZA_ALL, CZC_COLOR, "Lhota" }, - { CZG_SFEM, CZA_ALL, CZC_COLOR, "Hlava" }, - { CZG_SFEM, CZA_ALL, CZC_COLOR, "L\xC3\xADpa" }, - { CZG_SNEUT, CZA_ALL, CZC_COLOR, "Pole" }, - { CZG_SNEUT, CZA_ALL, CZC_COLOR, "\xC3\x9A""dol\xC3\xAD" }, - { CZG_PMASC, CZA_ALL, CZC_NONE, "\xC3\x9Avaly" }, - { CZG_PFEM, CZA_ALL, CZC_COLOR, "Luka" }, - { CZG_PNEUT, CZA_ALL, CZC_COLOR, "Pole" }, -}; - -/* TODO: More stems needed. --pasky */ -static const CzechNameSubst _name_czech_subst_stem[] = { - { CZG_SMASC, CZA_MIDDLE, CZC_COLOR, "Kostel" }, - { CZG_SMASC, CZA_MIDDLE, CZC_COLOR, "Kl\xC3\xA1\xC5\xA1ter" }, - { CZG_SMASC, CZA_SHORT, CZC_COLOR, "Lhot" }, - { CZG_SFEM, CZA_SHORT, CZC_COLOR, "Lhot" }, - { CZG_SFEM, CZA_SHORT, CZC_COLOR, "Hur" }, - { CZG_FREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Sedl" }, - { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_COLOR, "Hrad" }, - { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Pras" }, - { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Ba\xC5\xBE" }, - { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Tes" }, - { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "U\xC5\xBE" }, - { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_POSTFIX, "B\xC5\x99" }, - { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Vod" }, - { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Jan" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Prach" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Kunr" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Strak" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "V\xC3\xADt" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Vy\xC5\xA1" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "\xC5\xBD""at" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "\xC5\xBD""er" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "St\xC5\x99""ed" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Harv" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Pruh" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Tach" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "P\xC3\xADsn" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Jin" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Jes" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Jar" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Sok" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Hod" }, - { CZG_NFREE, CZA_LONG, CZC_NONE, "Net" }, - { CZG_FREE, CZA_LONG, CZC_NONE, "Pra\xC5\xBE" }, - { CZG_FREE, CZA_LONG, CZC_NONE, "Nerat" }, - { CZG_FREE, CZA_LONG, CZC_NONE, "Kral" }, - { CZG_FREE, CZA_LONG, CZC_NONE, "Hut" }, - { CZG_FREE, CZA_LONG, CZC_NOPOSTFIX, "Pan" }, - { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_NOPOSTFIX, "Odst\xC5\x99""ed" }, - { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_COLOR, "Mrat" }, - { CZG_FREE, CZA_LONG, CZC_COLOR, "Hlav" }, - { CZG_FREE, CZA_SHORT | CZA_MIDDLE, CZC_NONE, "M\xC4\x9B\xC5\x99" }, - { CZG_FREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Lip" }, -}; - -/* Optional postfix inserted between stem and ending. */ -static const char * const _name_czech_subst_postfix[] = { - "av", "an", "at", - "ov", "on", "ot", - "ev", "en", "et", -}; - -/* This array must have the both neutral genders at the end! */ -static const CzechNameSubst _name_czech_subst_ending[] = { - { CZG_SMASC, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "ec" }, - { CZG_SMASC, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "\xC3\xADn" }, - { CZG_SMASC, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "ov" }, - { CZG_SMASC, CZA_SHORT | CZA_LONG, CZC_ANY, "kov" }, - { CZG_SMASC, CZA_LONG, CZC_POSTFIX, "\xC3\xADn" }, - { CZG_SMASC, CZA_LONG, CZC_POSTFIX, "n\xC3\xADk" }, - { CZG_SMASC, CZA_LONG, CZC_ANY, "burk" }, - { CZG_SFEM, CZA_SHORT, CZC_ANY, "ka" }, - { CZG_SFEM, CZA_MIDDLE, CZC_ANY, "inka" }, - { CZG_SFEM, CZA_MIDDLE, CZC_ANY, "n\xC3\xA1" }, - { CZG_SFEM, CZA_LONG, CZC_ANY, "ava" }, - { CZG_PMASC, CZA_LONG, CZC_POSTFIX, "\xC3\xADky" }, - { CZG_PMASC, CZA_LONG, CZC_ANY, "upy" }, - { CZG_PMASC, CZA_LONG, CZC_ANY, "olupy" }, - { CZG_PFEM, CZA_LONG, CZC_ANY, "avy" }, - { CZG_PFEM, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "ice" }, - { CZG_PFEM, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "i\xC4\x8Dky" }, - { CZG_PNEUT, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "na" }, - { CZG_SNEUT, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "no" }, - { CZG_SNEUT, CZA_LONG, CZC_ANY, "i\xC5\xA1t\xC4\x9B" }, -}; - -static const char * const _name_czech_suffix[] = { - "nad Cidlinou", - "nad Dyj\xC3\xAD", - "nad Jihlavou", - "nad Labem", - "nad Lesy", - "nad Moravou", - "nad Nisou", - "nad Odrou", - "nad Ostravic\xC3\xAD", - "nad S\xC3\xA1zavou", - "nad Vltavou", - "pod Prad\xC4\x9B""dem", - "pod Radho\xC5\xA1t\xC4\x9Bm", - "pod \xC5\x98\xC3\xADpem", - "pod Sn\xC4\x9B\xC5\xBEkou", - "pod \xC5\xA0pi\xC4\x8D\xC3\xA1kem", - "pod Sedlem", - "v \xC4\x8C""ech\xC3\xA1""ch", - "na Morav\xC4\x9B", -}; - - - -static const char * const _name_romanian_real[] = { - "Adjud", - "Alba Iulia", - "Alexandria", - "Babadag", - "Bac\xC3\xA3u", - "Baia Mare", - "B\xC3\xA3ile Herculane", - "B\xC3\xA3ilesti", - "B\xC3\xA2rlad", - "Bicaz", - "Bistrita", - "Blaj", - "Borsec", - "Botosani", - "Br\xC3\xA3ila", - "Brasov", - "Bucuresti", - "Buftea", - "Buz\xC3\xA3u", - "C\xC3\xA3l\xC3\xA3rasi", - "Caransebes", - "Cernavod\xC3\xA3", - "Cluj-Napoca", - "Constanta", - "Covasna", - "Craiova", - "Dej", - "Deva", - "Dorohoi", - "Dr.-Tr. Severin", - "Dr\xC3\xA3g\xC3\xA3sani", - "F\xC3\xA3g\xC3\xA3ras", - "F\xC3\xA3lticeni", - "Fetesti", - "Focsani", - "Galati", - "Gheorgheni", - "Giurgiu", - "H\xC3\xA2rsova", - "Hunedoara", - "Husi", - "Iasi", - "Isaccea", - "Lugoj", - "M\xC3\xA3""cin", - "Mangalia", - "Medgidia", - "Medias", - "Miercurea Ciuc", - "Mizil", - "Motru", - "N\xC3\xA3s\xC3\xA3ud", - "N\xC3\xA3vodari", - "Odobesti", - "Oltenita", - "Onesti", - "Oradea", - "Orsova", - "Petrosani", - "Piatra Neamt", - "Pitesti", - "Ploiesti", - "Predeal", - "R\xC3\xA2mnicu V\xC3\xA2lcea", - "Reghin", - "Resita", - "Roman", - "Rosiorii de Vede", - "Satu Mare", - "Sebes", - "Sf\xC3\xA2ntu Gheorghe", - "Sibiu", - "Sighisoara", - "Sinaia", - "Slatina", - "Slobozia", - "Sovata", - "Suceava", - "Sulina", - "T\xC3\xA3nd\xC3\xA3rei", - "T\xC3\xA2rgoviste", - "T\xC3\xA2rgu Jiu", - "T\xC3\xA2rgu Mures", - "Tecuci", - "Timisoara", - "Tulcea", - "Turda", - "Turnu M\xC3\xA3gurele", - "Urziceni", - "Vaslui", - "Vatra Dornei", - "Victoria", - "Videle", - "Zal\xC3\xA3u", -}; - -static const char * const _name_slovak_real[] = { - "Bratislava", - "Banovce nad Bebravou", - "Banska Bystrica", - "Banska Stiavnica", - "Bardejov", - "Brezno", - "Brezova pod Bradlom", - "Bytca", - "Cadca", - "Cierna nad Tisou", - "Detva", - "Detva", - "Dolny Kubin", - "Dolny Kubin", - "Dunajska Streda", - "Gabcikovo", - "Galanta", - "Gbely", - "Gelnica", - "Handlova", - "Hlohovec", - "Holic", - "Humenne", - "Hurbanovo", - "Kezmarok", - "Komarno", - "Kosice", - "Kremnica", - "Krompachy", - "Kuty", - "Leopoldov", - "Levoca", - "Liptovsky Mikulas", - "Lucenec", - "Malacky", - "Martin", - "Medzilaborce", - "Michalovce", - "Modra", - "Myjava", - "Namestovo", - "Nitra", - "Nova Bana", - "Nove Mesto nad Vahom", - "Nove Zamky", - "Partizanske", - "Pezinok", - "Piestany", - "Poltar", - "Poprad", - "Povazska Bystrica", - "Prievidza", - "Puchov", - "Revuca", - "Rimavska Sobota", - "Roznava", - "Ruzomberok", - "Sabinov", - "Sala", - "Senec", - "Senica", - "Sered", - "Skalica", - "Sladkovicovo", - "Smolenice", - "Snina", - "Stara Lubovna", - "Stara Tura", - "Strazske", - "Stropkov", - "Stupava", - "Sturovo", - "Sulekovo", - "Topolcany", - "Trebisov", - "Trencin", - "Trnava", - "Turcianske Teplice", - "Tvrdosin", - "Vrable", - "Vranov nad Toplov", - "Zahorska Bystrica", - "Zdiar", - "Ziar nad Hronom", - "Zilina", - "Zlate Moravce", - "Zvolen", -}; - -static const char * const _name_norwegian_1[] = { - "Arna", - "Aust", - "Bj\xC3\xB8rk", - "Bj\xC3\xB8rn", - "Brand", - "B\xC3\xB8ver", - "Drag", - "Dr\xC3\xB8", - "Eids", - "Egge", - "Fager", - "Finns", - "Flat", - "Foll", - "Foss", - "Fugle", - "Furu", - "Gaus", - "Galte", - "Geir", - "Gl\xC3\xB8s", - "Gran", - "Grind", - "Grims", - "Gr\xC3\xB8n", - "Gr\xC3\xB8t", - "Gulle", - "Haka", - "Hammer", - "Haug", - "Hol", - "Hon", - "Hop", - "Hov", - "Jess", - "Kabel", - "Kjerns", - "Kjerring", - "Knatte", - "Krok", - "K\xC3\xB8y", - "Lang", - "Lauv", - "Leir", - "Lund", - "Logn", - "Lo", - "Lyng", - "L\xC3\xB8n", - "Mesna", - "Mel", - "Mo", - "Nar", - "Nitte", - "Nord", - "Odd", - "Ola", - "Otte", - "Ran", - "Rev", - "Rog", - "Roms", - "Rosen", - "Sand", - "Sau", - "Sel", - "Sol", - "Sjur", - "Sk\xC3\xA5r", - "Sl\xC3\xA5tt", - "Stj\xC3\xB8r", - "Stor", - "Svart", - "Svens", - "Svin", - "Sylte", - "Syn", - "Tran", - "Vass", - "Ved", - "Vest", - "Vesle", - "Vik", - "V\xC3\xA5g", -}; - -static const char * const _name_norwegian_2[] = { - "aker", - "anger", - "bakken", - "bekk", - "berg", - "botn", - "breen", - "bu", - "bugen", - "by", - "bygd", - "b\xC3\xB8", - "dal", - "egga", - "eid", - "elv", - "enga", - "foss", - "fjell", - "fjord", - "foten", - "gard", - "grend", - "hammer", - "haug", - "havn", - "heim", - "hella", - "hovda", - "h\xC3\xB8""a", - "h\xC3\xB8gda", - "kampen", - "kj\xC3\xB8len", - "kollen", - "kroken", - "land", - "lia", - "mark", - "moen", - "myr", - "nes", - "nuten", - "osen", - "rike", - "rud", - "sand", - "set", - "sj\xC3\xB8""en", - "skogen", - "slette", - "snipa", - "stad", - "stua", - "stulen", - "sund", - "svingen", - "s\xC3\xA6tra", - "tinden", - "tun", - "vang", - "vatn", - "veid", - "vik", - "voll", - "v\xC3\xA5g", - "um", - "\xC3\xA5sen", -}; - -static const char * const _name_norwegian_real[] = { - "Alta", - "Arendal", - "Askim", - "Bergen", - "Bod\xC3\xB8", - "Brevik", - "Bryne", - "Br\xC3\xB8nn\xC3\xB8ysund", - "Drammen", - "Dr\xC3\xB8""bak", - "Egersund", - "Elverum", - "Farsund", - "Fauske", - "Finnsnes", - "Flekkefjord", - "Flora", - "Fosnav\xC3\xA5g", - "Fredrikstad", - "F\xC3\xB8rde", - "Gj\xC3\xB8vik", - "Grimstad", - "Halden", - "Hamar", - "Hammerfest", - "Harstad", - "Haugesund", - "Holmestrand", - "Horten", - "J\xC3\xB8rpeland", - "Kirkenes", - "Kolvereid", - "Kongsberg", - "Kongsvinger", - "Kopervik", - "Krager\xC3\xB8", - "Kristiansand", - "Kristiansund", - "Langesund", - "Larvik", - "Leirvik", - "Leknes", - "Levanger", - "Lillehammer", - "Lillesand", - "Lillestr\xC3\xB8m", - "Lyngdal", - "L\xC3\xB8renskog", - "Mandal", - "Mo i Rana", - "Molde", - "Mosj\xC3\xB8""en", - "Moss", - "Mysen", - "M\xC3\xA5l\xC3\xB8y", - "Namsos", - "Narvik", - "Notodden", - "Odda", - "Oslo", - "Otta", - "Porsgrunn", - "Ringerike", - "Ris\xC3\xB8r", - "Rjukan", - "Sandefjord", - "Sandnes", - "Sandnessj\xC3\xB8""en", - "Sandvika", - "Sarpsborg", - "Sauda", - "Ski", - "Skien", - "Skudeneshavn", - "Sortland", - "Stathelle", - "Stavanger", - "Steinkjer", - "Stj\xC3\xB8rdal", - "Stokmarknes", - "Stord", - "Svelvik", - "Svolv\xC3\xA6r", - "Troms\xC3\xB8", - "Trondheim", - "Tvedestrand", - "T\xC3\xB8nsberg", - "Ulsteinvik", - "Vads\xC3\xB8", - "Vard\xC3\xB8", - "Verdals\xC3\xB8ra", - "\xC3\x85krehamn", - "\xC3\x85lesund", - "\xC3\x85ndalsnes", -}; - -static const char * const _name_hungarian_1[] = { - "Nagy-", - "Kis-", - "Fels\xC5\x91-", - "Als\xC3\xB3-", - "\xC3\x9Aj-", -}; - -static const char * const _name_hungarian_2[] = { - "Bodrog", - "Dr\xC3\xA1va", - "Duna", - "Hej\xC5\x91", - "Hern\xC3\xA1""d", - "R\xC3\xA1""ba", - "Saj\xC3\xB3", - "Szamos", - "Tisza", - "Zala", - "Balaton", - "Fert\xC5\x91", - "Bakony", - "Cserh\xC3\xA1t", - "Bihar", - "Hajd\xC3\xBA", - "J\xC3\xA1sz", - "Kun", - "Magyar", - "N\xC3\xB3gr\xC3\xA1""d", - "Ny\xC3\xADr", - "Somogy", - "Sz\xC3\xA9kely", - "Buda", - "Gy\xC5\x91r", - "Pest", - "Feh\xC3\xA9r", - "Cser\xC3\xA9p", - "Erd\xC5\x91", - "Hegy", - "Homok", - "Mez\xC5\x91", - "Puszta", - "S\xC3\xA1r", - "Cs\xC3\xA1sz\xC3\xA1r", - "Herceg", - "Kir\xC3\xA1ly", - "Nemes", - "P\xC3\xBCsp\xC3\xB6k", - "Szent", - "Alm\xC3\xA1s", - "Szilv\xC3\xA1s", - "Agg", - "Aranyos", - "B\xC3\xA9k\xC3\xA9s", - "Egyh\xC3\xA1zas", - "Gagy", - "Heves", - "Kapos", - "T\xC3\xA1pi\xC3\xB3", - "Torna", - "Vas", - "V\xC3\xA1mos", - "V\xC3\xA1s\xC3\xA1ros", -}; - -static const char * const _name_hungarian_3[] = { - "ap\xC3\xA1ti", - "b\xC3\xA1""ba", - "bikk", - "dob", - "fa", - "f\xC3\xB6ld", - "hegyes", - "kak", - "kereszt", - "k\xC3\xBCrt", - "lad\xC3\xA1ny", - "m\xC3\xA9rges", - "szalonta", - "telek", - "vas", - "v\xC3\xB6lgy", -}; - -static const char * const _name_hungarian_4[] = { - "alja", - "egyh\xC3\xA1za", - "h\xC3\xA1za", - "\xC3\xBAr", - "v\xC3\xA1r", -}; - -static const char * const _name_hungarian_real[] = { - "Ajka", - "Asz\xC3\xB3""d", - "Badacsony", - "Baja", - "Budapest", - "Debrecen", - "Eger", - "Fony\xC3\xB3""d", - "G\xC3\xB6""d\xC3\xB6ll\xC5\x91", - "Gy\xC5\x91r", - "Gyula", - "Karcag", - "Kecskem\xC3\xA9t", - "Keszthely", - "Kisk\xC3\xB6re", - "Kocsord", - "Kom\xC3\xA1rom", - "K\xC5\x91szeg", - "Mak\xC3\xB3", - "Moh\xC3\xA1""cs", - "Miskolc", - "\xC3\x93zd", - "Paks", - "P\xC3\xA1pa", - "P\xC3\xA9""cs", - "Polg\xC3\xA1r", - "Sarkad", - "Si\xC3\xB3""fok", - "Szeged", - "Szentes", - "Szolnok", - "Tihany", - "Tokaj", - "V\xC3\xA1""c", - "Z\xC3\xA1hony", - "Zirc", -}; - -static const char * const _name_swiss_real[] = { - "Aarau", - "Aesch", - "Altdorf", - "Arosa", - "Appenzell", - "Arbon", - "Altst\xC3\xA4tten", - "Baar", - "Baden", - "Bellinzona", - "Brig-Glis", - "Bienne", - "Bulle", - "Binningen", - "Burgdorf", - "Bern", - "Basel", - "B\xC3\xBClach", - "Carouge", - "Cham", - "Chiasso", - "Chur", - "Davos", - "Del\xC3\xA9mont", - "Dietikon", - "D\xC3\xBC""bendorf", - "Emmen", - "Freienbach-Pf\xC3\xA4""ffikon", - "Fribourg", - "Frauenfeld", - "Gen\xC3\xA8ve", - "Glarus", - "Gossau", - "Grenchen", - "Herisau", - "Horgen", - "Horw", - "Illnau-Effretikon", - "Ittigen", - "Jona", - "Kriens", - "Kloten", - "K\xC3\xB6niz", - "Kreuzlingen", - "K\xC3\xBCsnacht", - "Agen", - "Lancy", - "La Chaux-de-Fonds", - "Lenzburg", - "Lugano", - "Langenthal", - "Littau", - "Le Locle", - "La Neuveville", - "Locarno", - "Liestal", - "La Tour-de-Peilz", - "Lausanne", - "Lyss", - "Luzern", - "Martigny", - "M\xC3\xBCnchenstein", - "Meyrin", - "Montreux", - "Monthey", - "Morges", - "Murten", - "Moutier", - "Muttenz", - "Neuch\xC3\xA2tel", - "Neuhausen am Rheinfall", - "Nyon", - "Olten", - "Onex", - "Opfikon", - "Ostermundigen", - "Payerne", - "Peseux", - "Prilly", - "Pully", - "Rapperswil", - "Richterswil", - "Regensdorf", - "Rheinfelden", - "Riehen", - "Renens", - "Romanshorn", - "Rorschach", - "Stans", - "Schaffhausen", - "Steffisburg", - "St. Gallen", - "Schlieren", - "Sierre", - "Solothurn", - "St. Moritz", - "Sion", - "Spiez", - "St\xC3\xA4""fa", - "Sursee", - "Schwyz", - "Thalwil", - "Thônex", - "Thun", - "Uster", - "Uzwil", - "Vernier", - "Volketswil", - "Versoix", - "Vevey", - "W\xC3\xA4""denswil", - "Wettingen", - "Wil", - "Wallisellen", - "Winterthur", - "Wohlen", - "Worb", - "Wetzikon", - "Yverdon-les-Bains", - "Zollikon", - "Zofingen", - "Z\xC3\xBCrich", - "Zug", -}; - -static const char * const _name_danish_1[] = { - "Gamle ", - "Lille ", - "Nye ", - "Store ", - "Kirke ", - "N\xC3\xB8rre ", - "Vester ", - "S\xC3\xB8nder ", - "\xC3\x98ster ", - "Hvide ", - "H\xC3\xB8je ", - "Kongens ", -}; - -static const char * const _name_danish_2[] = { - "Ager", - "Alle", - "Aske", - "Balle", - "Bede", - "Birke", - "Bjerring", - "Bj\xC3\xA6ver", - "Blommens", - "Blok", - "Bolder", - "Bred", - "Charlotten", - "Christians", - "Danne", - "Diana", - "Es", - "Fredens", - "Frederiks", - "Fugle", - "F\xC3\xA5re", - "Gille", - "Gis", - "Givs", - "Glams", - "Glo", - "Guld", - "Had", - "Haralds", - "Hassel", - "Hede", - "Helle", - "Hessel", - "Hjorts", - "Hol", - "Horn", - "Humle", - "H\xC3\xB8j", - "H\xC3\xB8r", - "Is", - "Jyde", - "J\xC3\xA6gers", - "Karls", - "Klov", - "Kokke", - "Kvist", - "Lang", - "Lange", - "Mari", - "Nord", - "Ny", - "Oks", - "Ring", - "R\xC3\xB8""de", - "Rung", - "R\xC3\xB8r", - "Rud", - "Saks", - "Salt", - "Skam", - "Silke", - "Skod", - "Sk\xC3\xA6l", - "Sk\xC3\xA6r", - "Sol", - "Svend", - "Svine", - "Strand", - "Stubbe", - "Ting", - "Tj\xC3\xA6re", - "Tore", - "Uger", - "Ulf", - "Val", - "Vand", - "Vej", - "Vor", - "V\xC3\xA6r", - "\xC3\x98r", - "\xC3\x85l", -}; - -static const char * const _name_danish_3[] = { - "basse", - "borg", - "berg", - "bro", - "by", - "havn", - "strup", - "holm", - "hus", - "k\xC3\xB8""bing", - "lund", - "lunde", - "sund", - "ovre", - "h\xC3\xB8j", - "dal", - "sted", - "sten", - "l\xC3\xB8se", - "r\xC3\xB8""d", - "magle", - "s\xC3\xB8", - "bjerg", - "b\xC3\xA6k", - "drup", - "lev", - "bo", - "lyst", - "feld", - "skov", -}; - -static const char * const _name_turkish_prefix[] = { - "Ak\xC3\xA7""a", - "Alt\xC4\xB1n", - "Bah\xC3\xA7""e", - "Boz", - "B\xC3\xBCy\xC3\xBCk", - "\xC3\x87""ay", - "Do\xC4\x9Fu", - "Eski", - "G\xC3\xBCzel", - "K\xC4\xB1z\xC4\xB1l", - "K\xC3\xBC\xC3\xA7\xC3\xBCk", - "Orta", - "Sar\xC4\xB1", - "Sultan", - "Ulu", - "Yeni", -}; - -static const char * const _name_turkish_middle[] = { - "aga\xC3\xA7", - "ayva", - "\xC3\xA7""am", - "elma", - "kurt", - "pazar", - "yal\xC4\xB1", -}; - -static const char * const _name_turkish_suffix[] = { - "dere", - "hisar", - "kale", - "kaya", - "kent", - "k\xC3\xB6y", - "ova", - "\xC3\xB6z\xC3\xBC", - "\xC3\xB6ren", - "pazar", - "saray", - "tepe", - "yer", - "yurt", -}; - -static const char * const _name_turkish_real[] = { - "Adana", - "Ad\xC4\xB1yaman", - "Afyon", - "A\xC4\x9Fr\xC4\xB1", - "Amasya", - "Antalya", - "Artvin", - "Bal\xC4\xB1kesir", - "Bilecik", - "Bitlis", - "Bolu", - "Burdur", - "Bursa", - "\xC3\x87""anakkale", - "\xC3\x87""ank\xC4\xB1r\xC4\xB1", - "Denizli", - "Diyarbak\xC4\xB1r", - "Edirne", - "Elaz\xC4\xB1\xC4\x9F", - "Erzurum", - "Eskisehir", - "Giresun", - "G\xC3\xBCm\xC3\xBC\xC5\x9Fhane", - "Hatay", - "Isparta", - "\xC4\xB0\xC3\xA7""el", - "\xC4\xB0stanbul", - "\xC4\xB0zmir", - "Kars", - "Kastamonu", - "Kayseri", - "Kirklareli", - "Kocaeli", - "Konya", - "K\xC3\xBCtahya", - "Malatya", - "Manisa", - "Kahramanmara\xC5\x9F", - "Mardin", - "Mu\xC4\x9Fla", - "Mu\xC5\x9F", - "Nev\xC5\x9F""ehir", - "Ni\xC4\x9F""de", - "Rize", - "Sakarya", - "Samsun", - "Siirt", - "Sinop", - "Sivas", - "Trabzon", - "\xC5\x9E""anl\xC4\xB1urfa", - "Van", - "Yozgat", - "Zonguldak", - "Aksaray", - "Bayburt", - "Karaman", - "\xC5\x9E\xC4\xB1rnak", - "Bart\xC4\xB1n", - "Ardahan", - "I\xC4\x9F""d\xC4\xB1r", - "Yalova", - "Karab\xC3\xBCk", - "Osmaniye", - "D\xC3\xBCzce", -}; - -static const char * const _name_italian_real[] = { - "Roma", - "Milano", - "Napoli", - "Torino", - "Venezia", - "Firenze", - "Palermo", - "Genova", - "Parma", - "Bologna", - "Bari", - "Cagliari", - "Sassari", - "Pisa", - "Aosta", - "Brescia", - "Verona", - "Bolzano", - "Padova", - "Udine", - "Trieste", - "Livorno", - "Ancona", - "Perugia", - "Pescara", - "L'Aquila", - "Campobasso", - "Potenza", - "Cosenza", - "Reggio Calabria", - "Catania", - "Caltanisetta", - "Agrigento", - "La Spezia", - "Modena", - "Vicenza", - "Mantova", - "Cremona", - "Piacenza", - "Reggio Emilia", - "Foggia", - "Benevento", - "Salerno", - "Catanzaro", - "Lecce", - "Como", - "Lecco", - "Sondrio", - "Trento", - "Desenzano", - "Cuneo", - "Asti", - "Lodi", - "Novara", - "Biella", - "Vercelli", - "Rieti", - "Nuoro", - "Oristano", - "Matera", - "Taranto", - "Varese", - "Bergamo", - "Pavia", - "Caserta", - "Frosinone", - "Latina", - "Enna", - "Ragusa", - "Siracusa", - "Pordenone", - "Imperia", - "Verbania", - "Alessandria", - "Messina", - "Siena", - "Arezzo", - "Grosseto", -}; - -static const char * const _name_italian_pref[] = { - "Alpe ", - "Borgo ", - "Cascina ", - "Castel ", - "Fonte ", - "Forte ", - "Malga ", - "Pieve ", - "Poggio ", - "Rocca ", - "Villa ", - "Villar ", -}; - -static const char * const _name_italian_1m[] = { - "Bel", - "Borgo", - "Bosco", - "Campo", - "Capo", - "Casal", - "Castel", - "Colle", - "Fiume", - "Fonte", - "Lago", - "Mezzo", - "Monte", - "Mon", - "Orto", - "Passo", - "Prato", - "Poggio", - "Ponte", - "Pozzo", - "Sasso", - "Tra", - "Tre", - "Ver", - "Vico", -}; - -static const char * const _name_italian_1f[] = { - "Acqua", - "Bra", - "Cala", - "Casa", - "Chiesa", - "Citta", - "Civita", - "Corte", - "Costa", - "Croce", - "Fontana", - "Grotta", - "Guardia", - "Mezza", - "Palma", - "Pietra", - "Ripa", - "Rocca", - "Serra", - "Torre", - "Val", - "Valle", - "Villa", -}; - -static const char * const _name_italian_2[] = { - "bell", - "bianc", - "cald", - "chiar", - "cort", - "ferrat", - "fier", - "fredd", - "gioios", - "grec", - "guzz", - "lung", - "long", - "migli", - "negr", - "ner", - "nov", - "nuov", - "ross", - "rotond", - "scur", - "secc", - "sett", - "vecchi", - "ventos", - "vers", - "viv", -}; - -static const char * const _name_italian_2i[] = { - "", - "breve", - "brevi", - "chiari", - "ferro", - "fieschi", - "fiore", - "fonte", - "forte", - "gate", - "leone", - "maggiore", - "minore", - "mole", - "monte", - "poli", - "scuri", - "terra", - "te", - "torrione", - "vento", - "verde", - "versiere", -}; - - -static const char * const _name_italian_3[] = { - " Marittimo", - " Marittima", - " del Capo", - " del Monte", - " di Sopra", - " di Sotto", - " sui Monti", - " dei Marmi", - " dei Sassi", - " delle Fonti", - " sui Prati", - " a Mare", - " Superiore", - " Inferiore", - " Terme", - " Alta", - " Bassa", - " Brianza", - " Vesuviano", - " Scrivia", - " Ticino", -}; - -static const char * const _name_italian_river1[] = { - " del", - " sul", - " al", - " nel", -}; - -static const char * const _name_italian_river2[] = { - "l'Adda", - "l'Adige", - "le Alpi", - "l'Arno", - " Bormida", - " Brenta", - "la Dora Baltea", - " Lambro", - " Mincio", - " Naviglio", - "l'Oglio", - "l'Olona", - "l'Ombrone", - " Panaro", - " Piave", - " Po", - " Reno", - " Scrivia", - " Secchia", - " Serio", - " Tagliamento", - " Tanaro", - " Taro", - " Ticino", - " Tevere", -}; - -static const char * const _name_catalan_real[] = { - "Barcelona", - "Hospitalet", - "Cerdanyola", - "Martorell", - "Badalona", - "Tarragona", - "Lleida", - "Girona", - "Sabadell", - "Terrassa", - "Reus", - "Valls", - "Vic", - "Vielha", - "Amposta", - "Tortosa", - "Berga", - "Olot", - "Mollerussa", - "Banyoles", - "Figueres", - "Balaguer", - "Vilafranca del Pened\xC3\xA8s", - "La seu d'Urgell", - "Pont de Suert", - "Igualada", - "Manresa", - "Solsona", - "Les borges blanques", - "Tremp", - "Sort", - "Colera", - "Portbou", - "El Vendrell", - "Falset", - "Ripoll", - "Cervera", - "Gandesa", - "Matar\xC3\xB3", - "Montblanc", - "Vilanova i la Geltr\xC3\xBA", - "T\xC3\xA0rrega", - "Camprodon", - "Campdev\xC3\xA0nol", - "Cambrils", - "Begur", - "Set Cases", - "Palafrugell", - "Begues", - "El Bruc", - "Cadaqu\xC3\xA9s", - "Collbat\xC3\xB3", - "Cervell\xC3\xB3", - "Esparraguera", - "Abrera", - "Alp", - "Das", - "Cercs", - "Manlleu", - "Masnou", - "Molins de rei", - "Monistrol", - "Rocallaura", - "Rub\xC3\xAD", - "Ripollet", - "Sitges", - "Roses", -}; - -static const char * const _name_catalan_pref[] = { - "Pont de ", - "Parets de ", - "Canet de ", - "Castellar de ", - "Corbera de ", - "Arenys de ", - "Calella de ", - "La seu de ", - "La bisbal de ", - "Torroella de ", - "Port de ", - "Vilafranca de ", - "Vilanova de ", - "Caldes de ", - "La Conca de ", - "Olesa de ", - "La Roca de ", - "Sant Esteve de ", - "Sant Andreu de ", - "Sant Jordi de ", - "Sant Joan de ", - "Sant Feliu de ", - "Sant Quirze de ", - "Sant Sadurn\xC3\xAD de ", - "Santa Coloma de ", - "Santa Margarida de ", - "Santa Maria de ", - "Sant Mart\xC3\xAD de ", - "Sant Pere de ", - "Sant Juli\xC3\xA0 de ", - "Sant Vicen\xC3\xA7 de ", - -}; - -static const char * const _name_catalan_1m[] = { - "Torrent", - "Cami", - "Mont", - "Bell", - "Puig", - "Riu", -}; - -static const char * const _name_catalan_1f[] = { - "Aigua", - "Selva ", - "Vall", - "Serra", - "Torre", - "Riba", - "Vall", - "Terra", -}; - -static const char * const _name_catalan_2m[] = { - "alt", - "baix", - "fosc", - "pelat", - "vent\xC3\xB3s", - "negre", - "roig", - "gris", -}; - -static const char * const _name_catalan_2f[] = { - "baixa", - "alta", - "fosca", - "clara", - "negra", - "roja", - "grisa", - "freda", -}; - -static const char * const _name_catalan_3[] = { - " desp\xC3\xAD", - " desvern", - " del cam\xC3\xAD", - " de Mar", - " de Dalt", - " de Baix", - " del Vall\xC3\xA8s", - " de Bergued\xC3\xA0", - " de Conflent", - " de la plana", -}; - -static const char * const _name_catalan_river1[] = { - " d'Anoia", - " de Ter", - " de Llobregat", - " d'Ebre", - " de Segre", - " de Francol\xC3\xAD", -}; diff --git a/src/table/townname.h b/src/table/townname.h new file mode 100644 index 000000000..389530081 --- /dev/null +++ b/src/table/townname.h @@ -0,0 +1,3317 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file table/townname.h Namepart tables for the town name generator */ + +#include "../core/enum_type.hpp" + +static const char * const _name_original_english_1[] = { + "Great ", + "Little ", + "New ", + "Fort ", +}; + +static const char * const _name_original_english_2[] = { + "Wr", + "B", + "C", + "Ch", + "Br", + "D", + "Dr", + "F", + "Fr", + "Fl", + "G", + "Gr", + "H", + "L", + "M", + "N", + "P", + "Pr", + "Pl", + "R", + "S", + "S", + "Sl", + "T", + "Tr", + "W", +}; + +static const char * const _name_original_english_3[] = { + "ar", + "a", + "e", + "in", + "on", + "u", + "un", + "en", +}; + +static const char * const _name_original_english_4[] = { + "n", + "ning", + "ding", + "d", + "", + "t", + "fing", +}; + +static const char * const _name_original_english_5[] = { + "ville", + "ham", + "field", + "ton", + "town", + "bridge", + "bury", + "wood", + "ford", + "hall", + "ston", + "way", + "stone", + "borough", + "ley", + "head", + "bourne", + "pool", + "worth", + "hill", + "well", + "hattan", + "burg", +}; + +static const char * const _name_original_english_6[] = { + "-on-sea", + " Bay", + " Market", + " Cross", + " Bridge", + " Falls", + " City", + " Ridge", + " Springs", +}; + +static const char * const _name_additional_english_prefix[] = { + "Great ", + "Little ", + "New ", + "Fort ", + "St. ", + "Old ", +}; + +static const char * const _name_additional_english_1a[] = { + "Pen", + "Lough", + "Stam", + "Aber", + "Acc", + "Ex", + "Ax", + "Bre", + "Cum", + "Dun", + "Fin", + "Inver", + "Kin", + "Mon", + "Nan", + "Nant", + "Pit", + "Pol", + "Pont", + "Strath", + "Tre", + "Tilly", + "Beck", + "Canter", + "Bath", + "Liver", + "Mal", + "Ox", + "Bletch", + "Maccles", + "Grim", + "Wind", + "Sher", + "Gates", + "Orp", + "Brom", + "Lewis", + "Whit", + "White", + "Worm", + "Tyne", + "Avon", + "Stan", +}; + +static const char * const _name_additional_english_1b1[] = { + "Wr", + "B", + "C", + "Ch", + "Br", + "D", + "Dr", + "F", + "Fr", + "Fl", + "G", + "Gr", + "H", + "L", + "M", + "N", + "P", + "Pr", + "Pl", + "R", + "S", + "S", + "Sl", + "T", + "Tr", + "W", +}; + +static const char * const _name_additional_english_1b2[] = { + "ar", + "a", + "e", + "in", + "on", + "u", + "o", + "ee", + "es", + "ea", + "un", + "en", +}; + +static const char * const _name_additional_english_1b3a[] = { + "n", + "d", + "", + "t", + "", + "", +}; + +static const char * const _name_additional_english_1b3b[] = { + "ning", + "ding", + "fing", +}; + +static const char * const _name_additional_english_2[] = { + "ville", + "ham", + "field", + "ton", + "town", + "borough", + "bridge", + "bury", + "wood", + "ditch", + "ford", + "hall", + "dean", + "leigh", + "dore", + "ston", + "stow", + "church", + "wich", + "low", + "way", + "stone", + "minster", + "ley", + "head", + "bourne", + "pool", + "worth", + "hill", + "well", + "hattan", + "burg", + "berg", + "burgh", + "port", + "stoke", + "haven", + "stable", + "stock", + "side", + "brook", + "don", + "den", + "down", + "nor", + "grove", + "combe", + "by", + "say", + "ney", + "chester", + "dale", + "ness", + "shaw", + "thwaite", +}; + +static const char * const _name_additional_english_3[] = { + "-on-sea", + " Bay", + " Market", + " Beeches", + " Common", + " Park", + " Heath", + " Marsh", + " Green", + " Castle", + " End", + " Rivers", + " Cross", + " Bridge", + " Falls", + " City", + " Ridge", + " Springs", +}; + +static const char * const _name_austrian_a1[] = { + "Bad ", + "Deutsch ", + "Gross ", + "Klein ", + "Markt ", + "Maria ", +}; + +static const char * const _name_austrian_a2[] = { + "Aus", + "Alten", + "Braun", + "V\xC3\xB6sl", + "Mittern", + "Nuss", + "Neu", + "Walters", + "Breiten", + "Eisen", + "Feld", + "Mittern", + "Gall", + "Obern", + "Grat", + "Heiligen", + "Hof", + "Holla", + "Stein", + "Eber", + "Eggen", + "Enzers", + "Frauen", + "Herren", + "Hof", + "H\xC3\xBCtt", + "Kaisers", + "K\xC3\xB6nigs", + "Knittel", + "Lang", + "Ober", + "Ollers", + "Pfaffen", + "Potten", + "Salz", + "Schwarz", + "Stocker", + "Unter", + "Utten", + "V\xC3\xB6sen", + "Vill", + "Weissen", +}; + +static const char * const _name_austrian_a3[] = { + "see", + "bach", + "dorf", + "ach", + "stein", + "hofen", + "au", + "ach", + "kirch", + "kirchen", + "kreuz", + "brunn", + "siedl", + "markt", + "wang", + "haag", +}; + +static const char * const _name_austrian_a4[] = { + "Bruck", + "Brunn", + "Gams", + "Grein", + "Ried", + "Faak", + "Zell", + "Spital", + "Kirchberg", + "Saal", + "Taferl", + "Wald", +}; + +static const char * const _name_austrian_a5[] = { + "St. ", + "Sankt ", +}; + +static const char * const _name_austrian_a6[] = { + "Aegyd", + "Andr\xC3\xA4", + "Georgen", + "Jakob", + "Johann", + "Leonhard", + "Marein", + "Lorenzen", + "Margarethen", + "Martin", + "Michael", + "Nikolai", + "Oswald", + "Peter", + "P\xC3\xB6lten", + "Stefan", + "Stephan", + "Thomas", + "Veit", + "Wolfgang", +}; + +static const char * const _name_austrian_f1[] = { + " an der ", + " ob der ", +}; + +static const char * const _name_austrian_f2[] = { + "Donau", + "Steyr", + "Lafnitz", + "Leitha", + "Thaya", + "Gail", + "Drau", + "Salzach", + "Ybbs", + "Traisen", + "Enns", + "Mur", + "Ill", +}; + +static const char * const _name_austrian_b1[] = { + " am ", +}; + +static const char * const _name_austrian_b2[] = { + "Brenner", + "Dachstein", + "Gebirge", + "Grossglockner", + "Hausruck", + "Semmering", + "Wagram", + "Wechsel", + "Wilden Kaiser", + "Ziller", +}; + +static const char * const _name_german_real[] = { + "Berlin", + "Bonn", + "Bremen", + "Cottbus", + "Chemnitz", + "Dortmund", + "Dresden", + "Erfurt", + "Erlangen", + "Essen", + "Fulda", + "Gera", + "Kassel", + "Kiel", + "K\xC3\xB6ln", + "L\xC3\xBC""beck", + "Magdeburg", + "M\xC3\xBCnchen", + "Potsdam", + "Stuttgart", + "Wiesbaden", +}; + +static const char * const _name_german_pre[] = { + "Bad ", + "Klein ", + "Neu ", +}; + +static const char * const _name_german_1[] = { + "Alb", + "Als", + "Ander", + "Arns", + "Bruns", + "Bam", + "Biele", + "Cloppen", + "Co", + "Duis", + "D\xC3\xBCssel", + "Dannen", + "Elb", + "Els", + "Elster", + "Eichen", + "Ems", + "Fahr", + "Falken", + "Flens", + "Frank", + "Frei", + "Freuden", + "Fried", + "F\xC3\xBCrsten", + "Hahn", + "Ham", + "Harz", + "Heidel", + "Hers", + "Herz", + "Holz", + "Hildes", + "Inns", + "Ilsen", + "Ingols", + "Kel", + "Kies", + "Korn", + "Kor", + "Kreuz", + "Kulm", + "Langen", + "Lim", + "Lohr", + "L\xC3\xBCne", + "Mel", + "Michels", + "M\xC3\xBChl", + "Naum", + "Nest", + "Nord", + "Nort", + "Nien", + "Nidda", + "Nieder", + "N\xC3\xBCrn", + "Ober", + "Offen", + "Osna", + "Olden", + "Ols", + "Oranien", + "Pader", + "Quedlin", + "Quer", + "Ravens", + "Regens", + "Rott", + "Ros", + "R\xC3\xBCssels", + "Saal", + "Saar", + "Salz", + "Sch\xC3\xB6ne", + "Schwein", + "Sonder", + "Sonnen", + "Stein", + "Strals", + "Straus", + "S\xC3\xBC""d", + "Ton", + "Unter", + "Ur", + "Vor", + "Wald", + "War", + "Wert", + "Wester", + "Witten", + "Wolfs", + "W\xC3\xBCrz", +}; + +static const char * const _name_german_2[] = { + "bach", + "berg", + "br\xC3\xBC""ck", + "br\xC3\xBC""cken", + "burg", + "dorf", + "feld", + "furt", + "hausen", + "haven", + "heim", + "horst", + "mund", + "m\xC3\xBCnster", + "stadt", + "wald", +}; + +static const char * const _name_german_3_an_der[] = { + " an der ", +}; + +static const char * const _name_german_3_am[] = { + " am ", +}; + +static const char * const _name_german_4_an_der[] = { + "Oder", + "Spree", + "Donau", + "Saale", + "Elbe", +}; + +static const char * const _name_german_4_am[] = { + "Main", +}; + +static const char * const _name_spanish_real[] = { + "Caracas", + "Maracay", + "Maracaibo", + "Valencia", + "El Dorado", + "Morrocoy", + "Cata", + "Cataito", + "Ciudad Bolivar", + "Barquisimeto", + "Merida", + "Puerto Ordaz", + "Santa Elena", + "San Juan", + "San Luis", + "San Rafael", + "Santiago", + "Barcelona", + "Barinas", + "San Cristobal", + "San Fransisco", + "San Martin", + "Guayana", + "San Carlos", + "El Limon", + "Coro", + "Corocoro", + "Puerto Ayacucho", + "Elorza", + "Arismendi", + "Trujillo", + "Carupano", + "Anaco", + "Lima", + "Cuzco", + "Iquitos", + "Callao", + "Huacho", + "Camana", + "Puerto Chala", + "Santa Cruz", + "Quito", + "Cuenca", + "Huacho", + "Tulcan", + "Esmeraldas", + "Ibarra", + "San Lorenzo", + "Macas", + "Morana", + "Machala", + "Zamora", + "Latacunga", + "Tena", + "Cochabamba", + "Ascension", + "Magdalena", + "Santa Ana", + "Manoa", + "Sucre", + "Oruro", + "Uyuni", + "Potosi", + "Tupiza", + "La Quiaca", + "Yacuiba", + "San Borja", + "Fuerte Olimpio", + "Fortin Esteros", + "Campo Grande", + "Bogota", + "El Banco", + "Zaragoza", + "Neiva", + "Mariano", + "Cali", + "La Palma", + "Andoas", + "Barranca", + "Montevideo", + "Valdivia", + "Arica", + "Temuco", + "Tocopilla", + "Mendoza", + "Santa Rosa", +}; + +static const char * const _name_french_real[] = { + "Agincourt", + "Lille", + "Dinan", + "Aubusson", + "Rodez", + "Bergerac", + "Bordeaux", + "Bayonne", + "Montpellier", + "Mont\xC3\xA9limar", + "Valence", + "Digne", + "Nice", + "Cannes", + "St. Tropez", + "Marseille", + "Narbonne", + "S\xC3\xA8te", + "Aurillac", + "Gu\xC3\xA9ret", + "Le Creusot", + "Nevers", + "Auxerre", + "Versailles", + "Meaux", + "Ch\xC3\xA2lons", + "Compi\xC3\xA8gne", + "Metz", + "Chaumont", + "Langres", + "Bourg", + "Lyon", + "Vienne", + "Grenoble", + "Toulon", + "Rennes", + "Le Mans", + "Angers", + "Nantes", + "Ch\xC3\xA2teauroux", + "Orl\xC3\xA9""ans", + "Lisieux", + "Cherbourg", + "Morlaix", + "Cognac", + "Agen", + "Tulle", + "Blois", + "Troyes", + "Charolles", + "Grenoble", + "Chamb\xC3\xA9ry", + "Tours", + "St. Brieuc", + "St. Malo", + "La Rochelle", + "St. Flour", + "Le Puy", + "Vichy", + "St. Valery", + "Beaujolais", + "Narbonne", + "Albi", + "Paris", + "Biarritz", + "B\xC3\xA9ziers", + "N\xC3\xAEmes", + "Chamonix", + "Angoul\xC3\xA8me", + "Alen\xC3\xA7on", +}; + +static const char * const _name_silly_1[] = { + "Binky", + "Blubber", + "Bumble", + "Crinkle", + "Crusty", + "Dangle", + "Dribble", + "Flippety", + "Google", + "Muffin", + "Nosey", + "Pinker", + "Quack", + "Rumble", + "Sleepy", + "Sliggles", + "Snooze", + "Teddy", + "Tinkle", + "Twister", + "Pinker", + "Hippo", + "Itchy", + "Jelly", + "Jingle", + "Jolly", + "Kipper", + "Lazy", + "Frogs", + "Mouse", + "Quack", + "Cheeky", + "Lumpy", + "Grumpy", + "Mangle", + "Fiddle", + "Slugs", + "Noodles", + "Poodles", + "Shiver", + "Rumble", + "Pixie", + "Puddle", + "Riddle", + "Rattle", + "Rickety", + "Waffle", + "Sagging", + "Sausage", + "Egg", + "Sleepy", + "Scatter", + "Scramble", + "Silly", + "Simple", + "Trickle", + "Slippery", + "Slimey", + "Slumber", + "Soggy", + "Sliggles", + "Splutter", + "Sulky", + "Swindle", + "Swivel", + "Tasty", + "Tangle", + "Toggle", + "Trotting", + "Tumble", + "Snooze", + "Water", + "Windy", + "Amble", + "Bubble", + "Cheery", + "Cheese", + "Cockle", + "Cracker", + "Crumple", + "Teddy", + "Evil", + "Fairy", + "Falling", + "Fishy", + "Fizzle", + "Frosty", + "Griddle", +}; + +static const char * const _name_silly_2[] = { + "ton", + "bury", + "bottom", + "ville", + "well", + "weed", + "worth", + "wig", + "wick", + "wood", + "pool", + "head", + "burg", + "gate", + "bridge", +}; + +static const char * const _name_swedish_1[] = { + "Gamla ", + "Lilla ", + "Nya ", + "Stora ", +}; + +static const char * const _name_swedish_2[] = { + "Boll", + "Bor", + "Ed", + "En", + "Erik", + "Es", + "Fin", + "Fisk", + "Gr\xC3\xB6n", + "Hag", + "Halm", + "Karl", + "Kram", + "Kung", + "Land", + "Lid", + "Lin", + "Mal", + "Malm", + "Marie", + "Ner", + "Norr", + "Oskar", + "Sand", + "Skog", + "Stock", + "Stor", + "Str\xC3\xB6m", + "Sund", + "S\xC3\xB6""der", + "Tall", + "Tratt", + "Troll", + "Upp", + "Var", + "V\xC3\xA4ster", + "\xC3\x84ngel", + "\xC3\x96ster", +}; + +static const char * const _name_swedish_2a[] = { + "B", + "Br", + "D", + "Dr", + "Dv", + "F", + "Fj", + "Fl", + "Fr", + "G", + "Gl", + "Gn", + "Gr", + "H", + "J", + "K", + "Kl", + "Kn", + "Kr", + "Kv", + "L", + "M", + "N", + "P", + "Pl", + "Pr", + "R", + "S", + "Sk", + "Skr", + "Sl", + "Sn", + "Sp", + "Spr", + "St", + "Str", + "Sv", + "T", + "Tr", + "Tv", + "V", + "Vr", +}; + +static const char * const _name_swedish_2b[] = { + "a", + "e", + "i", + "o", + "u", + "y", + "\xC3\xA5", + "\xC3\xA4", + "\xC3\xB6", +}; + +static const char * const _name_swedish_2c[] = { + "ck", + "d", + "dd", + "g", + "gg", + "l", + "ld", + "m", + "n", + "nd", + "ng", + "nn", + "p", + "pp", + "r", + "rd", + "rk", + "rp", + "rr", + "rt", + "s", + "sk", + "st", + "t", + "tt", + "v", +}; + +static const char * const _name_swedish_3[] = { + "arp", + "berg", + "boda", + "borg", + "bro", + "bukten", + "by", + "byn", + "fors", + "hammar", + "hamn", + "holm", + "hus", + "h\xC3\xA4ttan", + "kulle", + "k\xC3\xB6ping", + "lund", + "l\xC3\xB6v", + "sala", + "skrona", + "sl\xC3\xA4tt", + "sp\xC3\xA5ng", + "stad", + "sund", + "svall", + "svik", + "s\xC3\xA5ker", + "udde", + "valla", + "viken", + "\xC3\xA4lv", + "\xC3\xA5s", +}; + +static const char * const _name_dutch_1[] = { + "Nieuw ", + "Oud ", + "Groot ", + "Zuid ", + "Noord ", + "Oost ", + "West ", + "Klein ", +}; + +static const char * const _name_dutch_2[] = { + "Hoog", + "Laag", + "Zuider", + "Zuid", + "Ooster", + "Oost", + "Wester", + "West", + "Hoofd", + "Midden", + "Eind", + "Amster", + "Amstel", + "Dord", + "Rotter", + "Haar", + "Til", + "Enk", + "Dok", + "Veen", + "Leidsch", + "Lely", + "En", + "Kaats", + "U", + "Maas", + "Mar", + "Bla", + "Al", + "Alk", + "Eer", + "Drie", + "Ter", + "Groes", + "Goes", + "Soest", + "Coe", + "Uit", + "Zwaag", + "Hellen", + "Slie", + "IJ", + "Grubben", + "Groen", + "Lek", + "Ridder", + "Schie", + "Olde", + "Roose", + "Haar", + "Til", + "Loos", + "Hil", +}; + +static const char * const _name_dutch_3[] = { + "Drog", + "Nat", + "Valk", + "Bob", + "Dedem", + "Kollum", + "Best", + "Hoend", + "Leeuw", + "Graaf", + "Uithuis", + "Purm", + "Hard", + "Hell", + "Werk", + "Spijk", + "Vink", + "Wams", + "Heerhug", + "Koning", +}; + +static const char * const _name_dutch_4[] = { + "e", + "er", + "el", + "en", + "o", + "s", +}; + +static const char * const _name_dutch_5[] = { + "stad", + "vorst", + "dorp", + "dam", + "beek", + "doorn", + "zijl", + "zijlen", + "lo", + "muiden", + "meden", + "vliet", + "nisse", + "daal", + "vorden", + "vaart", + "mond", + "zaal", + "water", + "duinen", + "heuvel", + "geest", + "kerk", + "meer", + "maar", + "hoorn", + "rade", + "wijk", + "berg", + "heim", + "sum", + "richt", + "burg", + "recht", + "drecht", + "trecht", + "tricht", + "dricht", + "lum", + "rum", + "halen", + "oever", + "wolde", + "veen", + "hoven", + "gast", + "kum", + "hage", + "dijk", + "zwaag", + "pomp", + "huizen", + "bergen", + "schede", + "mere", + "end", +}; + +static const char * const _name_finnish_real[] = { + "Aijala", + "Kisko", + "Espoo", + "Helsinki", + "Tapiola", + "J\xC3\xA4rvel\xC3\xA4", + "Lahti", + "Kotka", + "Hamina", + "Loviisa", + "Kouvola", + "Tampere", + "Oulu", + "Salo", + "Malmi", + "Pelto", + "Koski", + "Iisalmi", + "Raisio", + "Taavetti", + "Joensuu", + "Imatra", + "Tapanila", + "Pasila", + "Turku", + "Kupittaa", + "Vaasa", + "Pori", + "Rauma", + "Kolari", + "Lieksa", +}; + +static const char * const _name_finnish_1[] = { + "Hiekka", + "Haapa", + "Mylly", + "Sauna", + "Uusi", + "Vanha", + "Kes\xC3\xA4", + "Kuusi", + "Pelto", + "Tuomi", + "Terva", + "Olki", + "Hein\xC3\xA4", + "Sein\xC3\xA4", + "Rova", + "Koivu", + "Kokko", + "M\xC3\xA4nty", + "Pihlaja", + "Pet\xC3\xA4j\xC3\xA4", + "Kielo", + "Kauha", + "Viita", + "Kivi", + "Riihi", + "\xC3\x84\xC3\xA4ne", + "Niini", +}; + +static const char * const _name_finnish_2[] = { + "Lappeen", + "Lohjan", + "Savon", + "Lapin", + "Pit\xC3\xA4j\xC3\xA4n", + "Martin", + "Kuusan", + "Kemi", + "Keri", + "H\xC3\xA4meen", + "Kangas", +}; + +static const char * const _name_finnish_3[] = { + "harju", + "linna", + "j\xC3\xA4rvi", + "kallio", + "m\xC3\xA4ki", + "nummi", + "joki", + "kyl\xC3\xA4", + "lampi", + "lahti", + "mets\xC3\xA4", + "suo", + "laakso", + "niitty", + "luoto", + "hovi", + "ranta", + "koski", + "salo", +}; + +static const char * const _name_polish_1_m[] = { + "Wielki ", + "Ma\xC5\x82y ", + "Z\xC5\x82y ", + "Dobry ", + "Nowy ", + "Stary ", + "Z\xC5\x82oty ", + "Zielony ", + "Bia\xC5\x82y ", + "Modry ", + "D\xC4\x99""bowy ", +}; + +static const char * const _name_polish_1_f[] = { + "Wielka ", + "Ma\xC5\x82""a ", + "Z\xC5\x82""a ", + "Dobra ", + "Nowa ", + "Stara ", + "Z\xC5\x82ota ", + "Zielona ", + "Bia\xC5\x82""a ", + "Modra ", + "D\xC4\x99""bowa ", +}; + +static const char * const _name_polish_1_n[] = { + "Wielkie ", + "Ma\xC5\x82""e ", + "Z\xC5\x82""e ", + "Dobre ", + "Nowe ", + "Stare ", + "Z\xC5\x82ote ", + "Zielone ", + "Bia\xC5\x82""e ", + "Modre ", + "D\xC4\x99""bowe ", +}; + +static const char * const _name_polish_2_o[] = { + "Frombork", + "Gniezno", + "Olsztyn", + "Toru\xC5\x84", + "Bydgoszcz", + "Terespol", + "Krak\xC3\xB3w", + "Pozna\xC5\x84", + "Wroc\xC5\x82""aw", + "Katowice", + "Cieszyn", + "Bytom", + "Frombork", + "Hel", + "Konin", + "Lublin", + "Malbork", + "Sopot", + "Sosnowiec", + "Gda\xC5\x84sk", + "Gdynia", + "Sieradz", + "Sandomierz", + "Szczyrk", + "Szczytno", + "Szczecin", + "Zakopane", + "Szklarska Por\xC4\x99""ba", + "Bochnia", + "Golub-Dobrzyn", + "Chojnice", + "Ostrowiec", + "Otwock", + "Wolsztyn", +}; + +static const char * const _name_polish_2_m[] = { + "Jarocin", + "Gogolin", + "Tomasz\xC3\xB3w", + "Piotrk\xC3\xB3w", + "Lidzbark", + "Rypin", + "Radzymin", + "Wo\xC5\x82omin", + "Pruszk\xC3\xB3w", + "Olsztynek", + "Rypin", + "Cisek", + "Krotoszyn", + "Stoczek", + "Lubin", + "Lubicz", + "Milicz", + "Targ", + "Ostr\xC3\xB3w", + "Ozimek", + "Puck", + "Rzepin", + "Siewierz", + "Stargard", + "Starogard", + "Turek", + "Tymbark", + "Wolsztyn", + "Strzepcz", + "Strzebielin", + "Sochaczew", + "Gr\xC4\x99""bocin", + "Gniew", + "Lubliniec", + "Lubasz", + "Lutomiersk", + "Niemodlin", + "Przeworsk", + "Ursus", + "Tyczyn", + "Sztum", + "Szczebrzeszyn", + "Wolin", + "Wrzeszcz", + "Zgierz", + "Zieleniec", + "Drobin", + "Garwolin", +}; + +static const char * const _name_polish_2_f[] = { + "Szprotawa", + "Pogorzelica", + "Mot\xC5\x82""awa", + "Lubawa", + "Nidzica", + "Kruszwica", + "Bierawa", + "Brodnica", + "Chojna", + "Krzepica", + "Ruda", + "Rumia", + "Tuchola", + "Trzebinia", + "Ustka", + "Warszawa", + "Bobowa", + "Dukla", + "Krynica", + "Murowana", + "Niemcza", + "Zaspa", + "Zawoja", + "Wola", + "Limanowa", + "Rabka", + "Skawina", + "Pilawa", +}; + +static const char * const _name_polish_2_n[] = { + "Lipsko", + "Pilzno", + "Przodkowo", + "Strzelno", + "Susz", + "Jaworzno", + "Choszczno", + "Mogilno", + "Luzino", + "Miasto", + "Dziadowo", + "Kowalewo", + "Legionowo", + "Miastko", + "Zabrze", + "Zawiercie", + "Kochanowo", + "Miechucino", + "Mirachowo", + "Robakowo", + "Kosakowo", + "Borne", + "Braniewo", + "Sulinowo", + "Chmielno", + "Jastrz\xC4\x99""bie", + "Gryfino", + "Koronowo", + "Lubichowo", + "Opoczno", +}; + +static const char * const _name_polish_3_m[] = { + " Wybudowanie", + " \xC5\x9Awi\xC4\x99tokrzyski", + " G\xC3\xB3rski", + " Morski", + " Zdr\xC3\xB3j", + " Wody", + " Bajoro", + " Kraje\xC5\x84ski", + " \xC5\x9Al\xC4\x85ski", + " Mazowiecki", + " Pomorski", + " Wielki", + " Maly", + " Warmi\xC5\x84ski", + " Mazurski", + " Mniejszy", + " Wi\xC4\x99kszy", + " G\xC3\xB3rny", + " Dolny", + " Wielki", + " Stary", + " Nowy", + " Wielkopolski", + " Wzg\xC3\xB3rze", + " Mosty", + " Kujawski", + " Ma\xC5\x82opolski", + " Podlaski", + " Lesny", +}; + +static const char * const _name_polish_3_f[] = { + " Wybudowanie", + " \xC5\x9Awi\xC4\x99tokrzyska", + " G\xC3\xB3rska", + " Morska", + " Zdr\xC3\xB3j", + " Woda", + " Bajoro", + " Kraje\xC5\x84ska", + " \xC5\x9Al\xC4\x85ska", + " Mazowiecka", + " Pomorska", + " Wielka", + " Ma\xC5\x82""a", + " Warmi\xC5\x84ska", + " Mazurska", + " Mniejsza", + " Wi\xC4\x99ksza", + " G\xC3\xB3rna", + " Dolna", + " Wielka", + " Stara", + " Nowa", + " Wielkopolska", + " Wzg\xC3\xB3rza", + " Mosty", + " Kujawska", + " Malopolska", + " Podlaska", + " Le\xC5\x9Bna", +}; + +static const char * const _name_polish_3_n[] = { + " Wybudowanie", + " \xC5\x9Awietokrzyskie", + " G\xC3\xB3rskie", + " Morskie", + " Zdr\xC3\xB3j", + " Wody", + " Bajoro", + " Kraje\xC5\x84skie", + " \xC5\x9Al\xC4\x85skie", + " Mazowieckie", + " Pomorskie", + " Wielkie", + " Ma\xC5\x82""e", + " Warmi\xC5\x84skie ", + " Mazurskie ", + " Mniejsze", + " Wi\xC4\x99ksze", + " G\xC3\xB3rne", + " Dolne", + " Wielkie", + " Stare", + " Nowe", + " Wielkopolskie", + " Wzg\xC3\xB3rze", + " Mosty", + " Kujawskie", + " Ma\xC5\x82opolskie", + " Podlaskie", + " Le\xC5\x9Bne", +}; + +static const char * const _name_czech_real[] = { + "A\xC5\xA1", + "Bene\xC5\xA1ov", + "Beroun", + "Bezdru\xC5\xBEice", + "Blansko", + "B\xC5\x99""eclav", + "Brno", + "Brunt\xC3\xA1l", + "\xC4\x8C""esk\xC3\xA1 L\xC3\xADpa", + "\xC4\x8C""esk\xC3\xA9 Bud\xC4\x9Bjovice", + "\xC4\x8C""esk\xC3\xBD Krumlov", + "D\xC4\x9B\xC4\x8D\xC3\xADn", + "Doma\xC5\xBElice", + "Dub\xC3\xAD", + "Fr\xC3\xBD""dek-M\xC3\xADstek", + "Havl\xC3\xAD\xC4\x8Dk\xC5\xAFv Brod", + "Hodon\xC3\xADn", + "Hradec Kr\xC3\xA1lov\xC3\xA9", + "Humpolec", + "Cheb", + "Chomutov", + "Chrudim", + "Jablonec nad Nisou", + "Jesen\xC3\xADk", + "Ji\xC4\x8D\xC3\xADn", + "Jihlava", + "Jind\xC5\x99ich\xC5\xAFv Hradec", + "Karlovy Vary", + "Karvin\xC3\xA1", + "Kladno", + "Klatovy", + "Kol\xC3\xADn", + "Kosmonosy", + "Krom\xC4\x9B\xC5\x99\xC3\xAD\xC5\xBE", + "Kutn\xC3\xA1 Hora", + "Liberec", + "Litom\xC4\x9B\xC5\x99ice", + "Louny", + "Man\xC4\x9Bt\xC3\xADn", + "M\xC4\x9Bln\xC3\xADk", + "Mlad\xC3\xA1 Boleslav", + "Most", + "N\xC3\xA1""chod", + "Nov\xC3\xBD Ji\xC4\x8D\xC3\xADn", + "Nymburk", + "Olomouc", + "Opava", + "Or\xC3\xA1\xC4\x8Dov", + "Ostrava", + "Pardubice", + "Pelh\xC5\x99imov", + "Pol\xC5\xBEice", + "P\xC3\xADsek", + "Plze\xC5\x88", + "Praha", + "Prachatice", + "P\xC5\x99""erov", + "P\xC5\x99\xC3\xAD""bram", + "Prost\xC4\x9Bjov", + "Rakovn\xC3\xADk", + "Rokycany", + "Rudn\xC3\xA1", + "Rychnov nad Kn\xC4\x9B\xC5\xBEnou", + "Semily", + "Sokolov", + "Strakonice", + "St\xC5\x99""edokluky", + "\xC5\xA0umperk", + "Svitavy", + "T\xC3\xA1""bor", + "Tachov", + "Teplice", + "T\xC5\x99""eb\xC3\xAD\xC4\x8D", + "Trutnov", + "Uhersk\xC3\xA9 Hradi\xC5\xA1t\xC4\x9B", + "\xC3\x9Ast\xC3\xAD nad Labem", + "\xC3\x9Ast\xC3\xAD nad Orlic\xC3\xAD", + "Vset\xC3\xADn", + "Vy\xC5\xA1kov", + "\xC5\xBD\xC4\x8F\xC3\xA1r nad S\xC3\xA1zavou", + "Zl\xC3\xADn", + "Znojmo", +}; + + +/* The advanced hyperintelligent Czech town names generator! + * The tables and MakeCzechTownName() is (c) Petr Baudis 2005 (GPL'd) + * Feel free to ask me about anything unclear or if you need help + * with cloning this for your own language. */ + +/* Sing., pl. */ +enum CzechGender { + CZG_SMASC, + CZG_SFEM, + CZG_SNEUT, + CZG_PMASC, + CZG_PFEM, + CZG_PNEUT, + /* Special for substantive stems - the ending chooses the gender. */ + CZG_FREE, + /* Like CZG_FREE, but disallow CZG_SNEUT. */ + CZG_NFREE +}; + +enum CzechPattern { + CZP_JARNI, + CZP_MLADY, + CZP_PRIVL +}; + +/* [CzechGender][CzechPattern] - replaces the last character of the adjective + * by this. + * XXX: [CZG_SMASC][CZP_PRIVL] needs special handling: -ovX -> -uv. */ +static const char * const _name_czech_patmod[][3] = { + /* CZG_SMASC */ { "\xC3\xAD", "\xC3\xBD", "X" }, + /* CZG_SFEM */ { "\xC3\xAD", "\xC3\xA1", "a" }, + /* CZG_SNEUT */ { "\xC3\xAD", "\xC3\xA9", "o" }, + /* CZG_PMASC */ { "\xC3\xAD", "\xC3\xA9", "y" }, + /* CZG_PFEM */ { "\xC3\xAD", "\xC3\xA9", "y" }, + /* CZG_PNEUT */ { "\xC3\xAD", "\xC3\xA1", "a" } +}; + +/* This way the substantives can choose only some adjectives/endings: + * At least one of these flags must be satisfied: */ +enum CzechAllow { + CZA_SHORT = 1, + CZA_MIDDLE = 2, + CZA_LONG = 4, + CZA_ALL = ~0 +}; + +DECLARE_ENUM_AS_BIT_SET(CzechAllow); + +/* All these flags must be satisfied (in the stem->others direction): */ +enum CzechChoose { + CZC_NONE = 0, // No requirements. + CZC_COLOR = 1, + CZC_POSTFIX = 2, // Matched if postfix was inserted. + CZC_NOPOSTFIX = 4, // Matched if no postfix was inserted. + CZC_ANY = ~0 +}; + +DECLARE_ENUM_AS_BIT_SET(CzechChoose); + +struct CzechNameSubst { + CzechGender gender; + CzechAllow allow; + CzechChoose choose; + const char *name; +}; + +struct CzechNameAdj { + CzechPattern pattern; + CzechChoose choose; + const char *name; +}; + +/* Some of items which should be common are doubled. */ +static const CzechNameAdj _name_czech_adj[] = { + { CZP_JARNI, CZC_ANY, "Horn\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "Horn\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "Doln\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "Doln\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "P\xC5\x99""edn\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "Zadn\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "Kosteln\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "Havran\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "\xC5\x98\xC3\xAD\xC4\x8Dn\xC3\xAD" }, + { CZP_JARNI, CZC_ANY, "Jezern\xC3\xAD" }, + { CZP_MLADY, CZC_ANY, "Velk\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Velk\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Mal\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Mal\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Vysok\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "\xC4\x8C""esk\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Moravsk\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Slov\xC3\xA1""ck\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Slezsk\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Uhersk\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Star\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Star\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Nov\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Nov\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Mlad\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Kr\xC3\xA1lovsk\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Kamenn\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Cihlov\xC3\xBD" }, + { CZP_MLADY, CZC_ANY, "Divn\xC3\xBD" }, + { CZP_MLADY, CZC_COLOR, "\xC4\x8C""erven\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "\xC4\x8C""erven\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "\xC4\x8C""erven\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "Zelen\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "\xC5\xBDlut\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "Siv\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "\xC5\xA0""ed\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "B\xC3\xADl\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "B\xC3\xADl\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "Modr\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "R\xC5\xAF\xC5\xBEov\xC3\xA1" }, + { CZP_MLADY, CZC_COLOR, "\xC4\x8C""ern\xC3\xA1" }, + { CZP_PRIVL, CZC_ANY, "Kr\xC3\xA1lova" }, + { CZP_PRIVL, CZC_ANY, "Janova" }, + { CZP_PRIVL, CZC_ANY, "Karlova" }, + { CZP_PRIVL, CZC_ANY, "Kry\xC5\xA1tofova" }, + { CZP_PRIVL, CZC_ANY, "Ji\xC5\x99\xC3\xADkova" }, + { CZP_PRIVL, CZC_ANY, "Petrova" }, + { CZP_PRIVL, CZC_ANY, "Sudovo" }, +}; + +/* Considered a stem for choose/allow matching purposes. */ +static const CzechNameSubst _name_czech_subst_full[] = { + { CZG_SMASC, CZA_ALL, CZC_COLOR, "Sedlec" }, + { CZG_SMASC, CZA_ALL, CZC_COLOR, "Brod" }, + { CZG_SMASC, CZA_ALL, CZC_COLOR, "Brod" }, + { CZG_SMASC, CZA_ALL, CZC_NONE, "\xC3\x9Aval" }, + { CZG_SMASC, CZA_ALL, CZC_COLOR, "\xC5\xBD\xC4\x8F\xC3\xA1r" }, + { CZG_SMASC, CZA_ALL, CZC_COLOR, "Smrk" }, + { CZG_SFEM, CZA_ALL, CZC_COLOR, "Hora" }, + { CZG_SFEM, CZA_ALL, CZC_COLOR, "Lhota" }, + { CZG_SFEM, CZA_ALL, CZC_COLOR, "Lhota" }, + { CZG_SFEM, CZA_ALL, CZC_COLOR, "Hlava" }, + { CZG_SFEM, CZA_ALL, CZC_COLOR, "L\xC3\xADpa" }, + { CZG_SNEUT, CZA_ALL, CZC_COLOR, "Pole" }, + { CZG_SNEUT, CZA_ALL, CZC_COLOR, "\xC3\x9A""dol\xC3\xAD" }, + { CZG_PMASC, CZA_ALL, CZC_NONE, "\xC3\x9Avaly" }, + { CZG_PFEM, CZA_ALL, CZC_COLOR, "Luka" }, + { CZG_PNEUT, CZA_ALL, CZC_COLOR, "Pole" }, +}; + +/* TODO: More stems needed. --pasky */ +static const CzechNameSubst _name_czech_subst_stem[] = { + { CZG_SMASC, CZA_MIDDLE, CZC_COLOR, "Kostel" }, + { CZG_SMASC, CZA_MIDDLE, CZC_COLOR, "Kl\xC3\xA1\xC5\xA1ter" }, + { CZG_SMASC, CZA_SHORT, CZC_COLOR, "Lhot" }, + { CZG_SFEM, CZA_SHORT, CZC_COLOR, "Lhot" }, + { CZG_SFEM, CZA_SHORT, CZC_COLOR, "Hur" }, + { CZG_FREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Sedl" }, + { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_COLOR, "Hrad" }, + { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Pras" }, + { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Ba\xC5\xBE" }, + { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "Tes" }, + { CZG_NFREE, CZA_MIDDLE, CZC_NONE, "U\xC5\xBE" }, + { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_POSTFIX, "B\xC5\x99" }, + { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Vod" }, + { CZG_NFREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Jan" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Prach" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Kunr" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Strak" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "V\xC3\xADt" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Vy\xC5\xA1" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "\xC5\xBD""at" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "\xC5\xBD""er" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "St\xC5\x99""ed" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Harv" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Pruh" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Tach" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "P\xC3\xADsn" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Jin" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Jes" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Jar" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Sok" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Hod" }, + { CZG_NFREE, CZA_LONG, CZC_NONE, "Net" }, + { CZG_FREE, CZA_LONG, CZC_NONE, "Pra\xC5\xBE" }, + { CZG_FREE, CZA_LONG, CZC_NONE, "Nerat" }, + { CZG_FREE, CZA_LONG, CZC_NONE, "Kral" }, + { CZG_FREE, CZA_LONG, CZC_NONE, "Hut" }, + { CZG_FREE, CZA_LONG, CZC_NOPOSTFIX, "Pan" }, + { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_NOPOSTFIX, "Odst\xC5\x99""ed" }, + { CZG_FREE, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_COLOR, "Mrat" }, + { CZG_FREE, CZA_LONG, CZC_COLOR, "Hlav" }, + { CZG_FREE, CZA_SHORT | CZA_MIDDLE, CZC_NONE, "M\xC4\x9B\xC5\x99" }, + { CZG_FREE, CZA_MIDDLE | CZA_LONG, CZC_NONE, "Lip" }, +}; + +/* Optional postfix inserted between stem and ending. */ +static const char * const _name_czech_subst_postfix[] = { + "av", "an", "at", + "ov", "on", "ot", + "ev", "en", "et", +}; + +/* This array must have the both neutral genders at the end! */ +static const CzechNameSubst _name_czech_subst_ending[] = { + { CZG_SMASC, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "ec" }, + { CZG_SMASC, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "\xC3\xADn" }, + { CZG_SMASC, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "ov" }, + { CZG_SMASC, CZA_SHORT | CZA_LONG, CZC_ANY, "kov" }, + { CZG_SMASC, CZA_LONG, CZC_POSTFIX, "\xC3\xADn" }, + { CZG_SMASC, CZA_LONG, CZC_POSTFIX, "n\xC3\xADk" }, + { CZG_SMASC, CZA_LONG, CZC_ANY, "burk" }, + { CZG_SFEM, CZA_SHORT, CZC_ANY, "ka" }, + { CZG_SFEM, CZA_MIDDLE, CZC_ANY, "inka" }, + { CZG_SFEM, CZA_MIDDLE, CZC_ANY, "n\xC3\xA1" }, + { CZG_SFEM, CZA_LONG, CZC_ANY, "ava" }, + { CZG_PMASC, CZA_LONG, CZC_POSTFIX, "\xC3\xADky" }, + { CZG_PMASC, CZA_LONG, CZC_ANY, "upy" }, + { CZG_PMASC, CZA_LONG, CZC_ANY, "olupy" }, + { CZG_PFEM, CZA_LONG, CZC_ANY, "avy" }, + { CZG_PFEM, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "ice" }, + { CZG_PFEM, CZA_SHORT | CZA_MIDDLE | CZA_LONG, CZC_ANY, "i\xC4\x8Dky" }, + { CZG_PNEUT, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "na" }, + { CZG_SNEUT, CZA_SHORT | CZA_MIDDLE, CZC_ANY, "no" }, + { CZG_SNEUT, CZA_LONG, CZC_ANY, "i\xC5\xA1t\xC4\x9B" }, +}; + +static const char * const _name_czech_suffix[] = { + "nad Cidlinou", + "nad Dyj\xC3\xAD", + "nad Jihlavou", + "nad Labem", + "nad Lesy", + "nad Moravou", + "nad Nisou", + "nad Odrou", + "nad Ostravic\xC3\xAD", + "nad S\xC3\xA1zavou", + "nad Vltavou", + "pod Prad\xC4\x9B""dem", + "pod Radho\xC5\xA1t\xC4\x9Bm", + "pod \xC5\x98\xC3\xADpem", + "pod Sn\xC4\x9B\xC5\xBEkou", + "pod \xC5\xA0pi\xC4\x8D\xC3\xA1kem", + "pod Sedlem", + "v \xC4\x8C""ech\xC3\xA1""ch", + "na Morav\xC4\x9B", +}; + + + +static const char * const _name_romanian_real[] = { + "Adjud", + "Alba Iulia", + "Alexandria", + "Babadag", + "Bac\xC3\xA3u", + "Baia Mare", + "B\xC3\xA3ile Herculane", + "B\xC3\xA3ilesti", + "B\xC3\xA2rlad", + "Bicaz", + "Bistrita", + "Blaj", + "Borsec", + "Botosani", + "Br\xC3\xA3ila", + "Brasov", + "Bucuresti", + "Buftea", + "Buz\xC3\xA3u", + "C\xC3\xA3l\xC3\xA3rasi", + "Caransebes", + "Cernavod\xC3\xA3", + "Cluj-Napoca", + "Constanta", + "Covasna", + "Craiova", + "Dej", + "Deva", + "Dorohoi", + "Dr.-Tr. Severin", + "Dr\xC3\xA3g\xC3\xA3sani", + "F\xC3\xA3g\xC3\xA3ras", + "F\xC3\xA3lticeni", + "Fetesti", + "Focsani", + "Galati", + "Gheorgheni", + "Giurgiu", + "H\xC3\xA2rsova", + "Hunedoara", + "Husi", + "Iasi", + "Isaccea", + "Lugoj", + "M\xC3\xA3""cin", + "Mangalia", + "Medgidia", + "Medias", + "Miercurea Ciuc", + "Mizil", + "Motru", + "N\xC3\xA3s\xC3\xA3ud", + "N\xC3\xA3vodari", + "Odobesti", + "Oltenita", + "Onesti", + "Oradea", + "Orsova", + "Petrosani", + "Piatra Neamt", + "Pitesti", + "Ploiesti", + "Predeal", + "R\xC3\xA2mnicu V\xC3\xA2lcea", + "Reghin", + "Resita", + "Roman", + "Rosiorii de Vede", + "Satu Mare", + "Sebes", + "Sf\xC3\xA2ntu Gheorghe", + "Sibiu", + "Sighisoara", + "Sinaia", + "Slatina", + "Slobozia", + "Sovata", + "Suceava", + "Sulina", + "T\xC3\xA3nd\xC3\xA3rei", + "T\xC3\xA2rgoviste", + "T\xC3\xA2rgu Jiu", + "T\xC3\xA2rgu Mures", + "Tecuci", + "Timisoara", + "Tulcea", + "Turda", + "Turnu M\xC3\xA3gurele", + "Urziceni", + "Vaslui", + "Vatra Dornei", + "Victoria", + "Videle", + "Zal\xC3\xA3u", +}; + +static const char * const _name_slovak_real[] = { + "Bratislava", + "Banovce nad Bebravou", + "Banska Bystrica", + "Banska Stiavnica", + "Bardejov", + "Brezno", + "Brezova pod Bradlom", + "Bytca", + "Cadca", + "Cierna nad Tisou", + "Detva", + "Detva", + "Dolny Kubin", + "Dolny Kubin", + "Dunajska Streda", + "Gabcikovo", + "Galanta", + "Gbely", + "Gelnica", + "Handlova", + "Hlohovec", + "Holic", + "Humenne", + "Hurbanovo", + "Kezmarok", + "Komarno", + "Kosice", + "Kremnica", + "Krompachy", + "Kuty", + "Leopoldov", + "Levoca", + "Liptovsky Mikulas", + "Lucenec", + "Malacky", + "Martin", + "Medzilaborce", + "Michalovce", + "Modra", + "Myjava", + "Namestovo", + "Nitra", + "Nova Bana", + "Nove Mesto nad Vahom", + "Nove Zamky", + "Partizanske", + "Pezinok", + "Piestany", + "Poltar", + "Poprad", + "Povazska Bystrica", + "Prievidza", + "Puchov", + "Revuca", + "Rimavska Sobota", + "Roznava", + "Ruzomberok", + "Sabinov", + "Sala", + "Senec", + "Senica", + "Sered", + "Skalica", + "Sladkovicovo", + "Smolenice", + "Snina", + "Stara Lubovna", + "Stara Tura", + "Strazske", + "Stropkov", + "Stupava", + "Sturovo", + "Sulekovo", + "Topolcany", + "Trebisov", + "Trencin", + "Trnava", + "Turcianske Teplice", + "Tvrdosin", + "Vrable", + "Vranov nad Toplov", + "Zahorska Bystrica", + "Zdiar", + "Ziar nad Hronom", + "Zilina", + "Zlate Moravce", + "Zvolen", +}; + +static const char * const _name_norwegian_1[] = { + "Arna", + "Aust", + "Bj\xC3\xB8rk", + "Bj\xC3\xB8rn", + "Brand", + "B\xC3\xB8ver", + "Drag", + "Dr\xC3\xB8", + "Eids", + "Egge", + "Fager", + "Finns", + "Flat", + "Foll", + "Foss", + "Fugle", + "Furu", + "Gaus", + "Galte", + "Geir", + "Gl\xC3\xB8s", + "Gran", + "Grind", + "Grims", + "Gr\xC3\xB8n", + "Gr\xC3\xB8t", + "Gulle", + "Haka", + "Hammer", + "Haug", + "Hol", + "Hon", + "Hop", + "Hov", + "Jess", + "Kabel", + "Kjerns", + "Kjerring", + "Knatte", + "Krok", + "K\xC3\xB8y", + "Lang", + "Lauv", + "Leir", + "Lund", + "Logn", + "Lo", + "Lyng", + "L\xC3\xB8n", + "Mesna", + "Mel", + "Mo", + "Nar", + "Nitte", + "Nord", + "Odd", + "Ola", + "Otte", + "Ran", + "Rev", + "Rog", + "Roms", + "Rosen", + "Sand", + "Sau", + "Sel", + "Sol", + "Sjur", + "Sk\xC3\xA5r", + "Sl\xC3\xA5tt", + "Stj\xC3\xB8r", + "Stor", + "Svart", + "Svens", + "Svin", + "Sylte", + "Syn", + "Tran", + "Vass", + "Ved", + "Vest", + "Vesle", + "Vik", + "V\xC3\xA5g", +}; + +static const char * const _name_norwegian_2[] = { + "aker", + "anger", + "bakken", + "bekk", + "berg", + "botn", + "breen", + "bu", + "bugen", + "by", + "bygd", + "b\xC3\xB8", + "dal", + "egga", + "eid", + "elv", + "enga", + "foss", + "fjell", + "fjord", + "foten", + "gard", + "grend", + "hammer", + "haug", + "havn", + "heim", + "hella", + "hovda", + "h\xC3\xB8""a", + "h\xC3\xB8gda", + "kampen", + "kj\xC3\xB8len", + "kollen", + "kroken", + "land", + "lia", + "mark", + "moen", + "myr", + "nes", + "nuten", + "osen", + "rike", + "rud", + "sand", + "set", + "sj\xC3\xB8""en", + "skogen", + "slette", + "snipa", + "stad", + "stua", + "stulen", + "sund", + "svingen", + "s\xC3\xA6tra", + "tinden", + "tun", + "vang", + "vatn", + "veid", + "vik", + "voll", + "v\xC3\xA5g", + "um", + "\xC3\xA5sen", +}; + +static const char * const _name_norwegian_real[] = { + "Alta", + "Arendal", + "Askim", + "Bergen", + "Bod\xC3\xB8", + "Brevik", + "Bryne", + "Br\xC3\xB8nn\xC3\xB8ysund", + "Drammen", + "Dr\xC3\xB8""bak", + "Egersund", + "Elverum", + "Farsund", + "Fauske", + "Finnsnes", + "Flekkefjord", + "Flora", + "Fosnav\xC3\xA5g", + "Fredrikstad", + "F\xC3\xB8rde", + "Gj\xC3\xB8vik", + "Grimstad", + "Halden", + "Hamar", + "Hammerfest", + "Harstad", + "Haugesund", + "Holmestrand", + "Horten", + "J\xC3\xB8rpeland", + "Kirkenes", + "Kolvereid", + "Kongsberg", + "Kongsvinger", + "Kopervik", + "Krager\xC3\xB8", + "Kristiansand", + "Kristiansund", + "Langesund", + "Larvik", + "Leirvik", + "Leknes", + "Levanger", + "Lillehammer", + "Lillesand", + "Lillestr\xC3\xB8m", + "Lyngdal", + "L\xC3\xB8renskog", + "Mandal", + "Mo i Rana", + "Molde", + "Mosj\xC3\xB8""en", + "Moss", + "Mysen", + "M\xC3\xA5l\xC3\xB8y", + "Namsos", + "Narvik", + "Notodden", + "Odda", + "Oslo", + "Otta", + "Porsgrunn", + "Ringerike", + "Ris\xC3\xB8r", + "Rjukan", + "Sandefjord", + "Sandnes", + "Sandnessj\xC3\xB8""en", + "Sandvika", + "Sarpsborg", + "Sauda", + "Ski", + "Skien", + "Skudeneshavn", + "Sortland", + "Stathelle", + "Stavanger", + "Steinkjer", + "Stj\xC3\xB8rdal", + "Stokmarknes", + "Stord", + "Svelvik", + "Svolv\xC3\xA6r", + "Troms\xC3\xB8", + "Trondheim", + "Tvedestrand", + "T\xC3\xB8nsberg", + "Ulsteinvik", + "Vads\xC3\xB8", + "Vard\xC3\xB8", + "Verdals\xC3\xB8ra", + "\xC3\x85krehamn", + "\xC3\x85lesund", + "\xC3\x85ndalsnes", +}; + +static const char * const _name_hungarian_1[] = { + "Nagy-", + "Kis-", + "Fels\xC5\x91-", + "Als\xC3\xB3-", + "\xC3\x9Aj-", +}; + +static const char * const _name_hungarian_2[] = { + "Bodrog", + "Dr\xC3\xA1va", + "Duna", + "Hej\xC5\x91", + "Hern\xC3\xA1""d", + "R\xC3\xA1""ba", + "Saj\xC3\xB3", + "Szamos", + "Tisza", + "Zala", + "Balaton", + "Fert\xC5\x91", + "Bakony", + "Cserh\xC3\xA1t", + "Bihar", + "Hajd\xC3\xBA", + "J\xC3\xA1sz", + "Kun", + "Magyar", + "N\xC3\xB3gr\xC3\xA1""d", + "Ny\xC3\xADr", + "Somogy", + "Sz\xC3\xA9kely", + "Buda", + "Gy\xC5\x91r", + "Pest", + "Feh\xC3\xA9r", + "Cser\xC3\xA9p", + "Erd\xC5\x91", + "Hegy", + "Homok", + "Mez\xC5\x91", + "Puszta", + "S\xC3\xA1r", + "Cs\xC3\xA1sz\xC3\xA1r", + "Herceg", + "Kir\xC3\xA1ly", + "Nemes", + "P\xC3\xBCsp\xC3\xB6k", + "Szent", + "Alm\xC3\xA1s", + "Szilv\xC3\xA1s", + "Agg", + "Aranyos", + "B\xC3\xA9k\xC3\xA9s", + "Egyh\xC3\xA1zas", + "Gagy", + "Heves", + "Kapos", + "T\xC3\xA1pi\xC3\xB3", + "Torna", + "Vas", + "V\xC3\xA1mos", + "V\xC3\xA1s\xC3\xA1ros", +}; + +static const char * const _name_hungarian_3[] = { + "ap\xC3\xA1ti", + "b\xC3\xA1""ba", + "bikk", + "dob", + "fa", + "f\xC3\xB6ld", + "hegyes", + "kak", + "kereszt", + "k\xC3\xBCrt", + "lad\xC3\xA1ny", + "m\xC3\xA9rges", + "szalonta", + "telek", + "vas", + "v\xC3\xB6lgy", +}; + +static const char * const _name_hungarian_4[] = { + "alja", + "egyh\xC3\xA1za", + "h\xC3\xA1za", + "\xC3\xBAr", + "v\xC3\xA1r", +}; + +static const char * const _name_hungarian_real[] = { + "Ajka", + "Asz\xC3\xB3""d", + "Badacsony", + "Baja", + "Budapest", + "Debrecen", + "Eger", + "Fony\xC3\xB3""d", + "G\xC3\xB6""d\xC3\xB6ll\xC5\x91", + "Gy\xC5\x91r", + "Gyula", + "Karcag", + "Kecskem\xC3\xA9t", + "Keszthely", + "Kisk\xC3\xB6re", + "Kocsord", + "Kom\xC3\xA1rom", + "K\xC5\x91szeg", + "Mak\xC3\xB3", + "Moh\xC3\xA1""cs", + "Miskolc", + "\xC3\x93zd", + "Paks", + "P\xC3\xA1pa", + "P\xC3\xA9""cs", + "Polg\xC3\xA1r", + "Sarkad", + "Si\xC3\xB3""fok", + "Szeged", + "Szentes", + "Szolnok", + "Tihany", + "Tokaj", + "V\xC3\xA1""c", + "Z\xC3\xA1hony", + "Zirc", +}; + +static const char * const _name_swiss_real[] = { + "Aarau", + "Aesch", + "Altdorf", + "Arosa", + "Appenzell", + "Arbon", + "Altst\xC3\xA4tten", + "Baar", + "Baden", + "Bellinzona", + "Brig-Glis", + "Bienne", + "Bulle", + "Binningen", + "Burgdorf", + "Bern", + "Basel", + "B\xC3\xBClach", + "Carouge", + "Cham", + "Chiasso", + "Chur", + "Davos", + "Del\xC3\xA9mont", + "Dietikon", + "D\xC3\xBC""bendorf", + "Emmen", + "Freienbach-Pf\xC3\xA4""ffikon", + "Fribourg", + "Frauenfeld", + "Gen\xC3\xA8ve", + "Glarus", + "Gossau", + "Grenchen", + "Herisau", + "Horgen", + "Horw", + "Illnau-Effretikon", + "Ittigen", + "Jona", + "Kriens", + "Kloten", + "K\xC3\xB6niz", + "Kreuzlingen", + "K\xC3\xBCsnacht", + "Agen", + "Lancy", + "La Chaux-de-Fonds", + "Lenzburg", + "Lugano", + "Langenthal", + "Littau", + "Le Locle", + "La Neuveville", + "Locarno", + "Liestal", + "La Tour-de-Peilz", + "Lausanne", + "Lyss", + "Luzern", + "Martigny", + "M\xC3\xBCnchenstein", + "Meyrin", + "Montreux", + "Monthey", + "Morges", + "Murten", + "Moutier", + "Muttenz", + "Neuch\xC3\xA2tel", + "Neuhausen am Rheinfall", + "Nyon", + "Olten", + "Onex", + "Opfikon", + "Ostermundigen", + "Payerne", + "Peseux", + "Prilly", + "Pully", + "Rapperswil", + "Richterswil", + "Regensdorf", + "Rheinfelden", + "Riehen", + "Renens", + "Romanshorn", + "Rorschach", + "Stans", + "Schaffhausen", + "Steffisburg", + "St. Gallen", + "Schlieren", + "Sierre", + "Solothurn", + "St. Moritz", + "Sion", + "Spiez", + "St\xC3\xA4""fa", + "Sursee", + "Schwyz", + "Thalwil", + "Thônex", + "Thun", + "Uster", + "Uzwil", + "Vernier", + "Volketswil", + "Versoix", + "Vevey", + "W\xC3\xA4""denswil", + "Wettingen", + "Wil", + "Wallisellen", + "Winterthur", + "Wohlen", + "Worb", + "Wetzikon", + "Yverdon-les-Bains", + "Zollikon", + "Zofingen", + "Z\xC3\xBCrich", + "Zug", +}; + +static const char * const _name_danish_1[] = { + "Gamle ", + "Lille ", + "Nye ", + "Store ", + "Kirke ", + "N\xC3\xB8rre ", + "Vester ", + "S\xC3\xB8nder ", + "\xC3\x98ster ", + "Hvide ", + "H\xC3\xB8je ", + "Kongens ", +}; + +static const char * const _name_danish_2[] = { + "Ager", + "Alle", + "Aske", + "Balle", + "Bede", + "Birke", + "Bjerring", + "Bj\xC3\xA6ver", + "Blommens", + "Blok", + "Bolder", + "Bred", + "Charlotten", + "Christians", + "Danne", + "Diana", + "Es", + "Fredens", + "Frederiks", + "Fugle", + "F\xC3\xA5re", + "Gille", + "Gis", + "Givs", + "Glams", + "Glo", + "Guld", + "Had", + "Haralds", + "Hassel", + "Hede", + "Helle", + "Hessel", + "Hjorts", + "Hol", + "Horn", + "Humle", + "H\xC3\xB8j", + "H\xC3\xB8r", + "Is", + "Jyde", + "J\xC3\xA6gers", + "Karls", + "Klov", + "Kokke", + "Kvist", + "Lang", + "Lange", + "Mari", + "Nord", + "Ny", + "Oks", + "Ring", + "R\xC3\xB8""de", + "Rung", + "R\xC3\xB8r", + "Rud", + "Saks", + "Salt", + "Skam", + "Silke", + "Skod", + "Sk\xC3\xA6l", + "Sk\xC3\xA6r", + "Sol", + "Svend", + "Svine", + "Strand", + "Stubbe", + "Ting", + "Tj\xC3\xA6re", + "Tore", + "Uger", + "Ulf", + "Val", + "Vand", + "Vej", + "Vor", + "V\xC3\xA6r", + "\xC3\x98r", + "\xC3\x85l", +}; + +static const char * const _name_danish_3[] = { + "basse", + "borg", + "berg", + "bro", + "by", + "havn", + "strup", + "holm", + "hus", + "k\xC3\xB8""bing", + "lund", + "lunde", + "sund", + "ovre", + "h\xC3\xB8j", + "dal", + "sted", + "sten", + "l\xC3\xB8se", + "r\xC3\xB8""d", + "magle", + "s\xC3\xB8", + "bjerg", + "b\xC3\xA6k", + "drup", + "lev", + "bo", + "lyst", + "feld", + "skov", +}; + +static const char * const _name_turkish_prefix[] = { + "Ak\xC3\xA7""a", + "Alt\xC4\xB1n", + "Bah\xC3\xA7""e", + "Boz", + "B\xC3\xBCy\xC3\xBCk", + "\xC3\x87""ay", + "Do\xC4\x9Fu", + "Eski", + "G\xC3\xBCzel", + "K\xC4\xB1z\xC4\xB1l", + "K\xC3\xBC\xC3\xA7\xC3\xBCk", + "Orta", + "Sar\xC4\xB1", + "Sultan", + "Ulu", + "Yeni", +}; + +static const char * const _name_turkish_middle[] = { + "aga\xC3\xA7", + "ayva", + "\xC3\xA7""am", + "elma", + "kurt", + "pazar", + "yal\xC4\xB1", +}; + +static const char * const _name_turkish_suffix[] = { + "dere", + "hisar", + "kale", + "kaya", + "kent", + "k\xC3\xB6y", + "ova", + "\xC3\xB6z\xC3\xBC", + "\xC3\xB6ren", + "pazar", + "saray", + "tepe", + "yer", + "yurt", +}; + +static const char * const _name_turkish_real[] = { + "Adana", + "Ad\xC4\xB1yaman", + "Afyon", + "A\xC4\x9Fr\xC4\xB1", + "Amasya", + "Antalya", + "Artvin", + "Bal\xC4\xB1kesir", + "Bilecik", + "Bitlis", + "Bolu", + "Burdur", + "Bursa", + "\xC3\x87""anakkale", + "\xC3\x87""ank\xC4\xB1r\xC4\xB1", + "Denizli", + "Diyarbak\xC4\xB1r", + "Edirne", + "Elaz\xC4\xB1\xC4\x9F", + "Erzurum", + "Eskisehir", + "Giresun", + "G\xC3\xBCm\xC3\xBC\xC5\x9Fhane", + "Hatay", + "Isparta", + "\xC4\xB0\xC3\xA7""el", + "\xC4\xB0stanbul", + "\xC4\xB0zmir", + "Kars", + "Kastamonu", + "Kayseri", + "Kirklareli", + "Kocaeli", + "Konya", + "K\xC3\xBCtahya", + "Malatya", + "Manisa", + "Kahramanmara\xC5\x9F", + "Mardin", + "Mu\xC4\x9Fla", + "Mu\xC5\x9F", + "Nev\xC5\x9F""ehir", + "Ni\xC4\x9F""de", + "Rize", + "Sakarya", + "Samsun", + "Siirt", + "Sinop", + "Sivas", + "Trabzon", + "\xC5\x9E""anl\xC4\xB1urfa", + "Van", + "Yozgat", + "Zonguldak", + "Aksaray", + "Bayburt", + "Karaman", + "\xC5\x9E\xC4\xB1rnak", + "Bart\xC4\xB1n", + "Ardahan", + "I\xC4\x9F""d\xC4\xB1r", + "Yalova", + "Karab\xC3\xBCk", + "Osmaniye", + "D\xC3\xBCzce", +}; + +static const char * const _name_italian_real[] = { + "Roma", + "Milano", + "Napoli", + "Torino", + "Venezia", + "Firenze", + "Palermo", + "Genova", + "Parma", + "Bologna", + "Bari", + "Cagliari", + "Sassari", + "Pisa", + "Aosta", + "Brescia", + "Verona", + "Bolzano", + "Padova", + "Udine", + "Trieste", + "Livorno", + "Ancona", + "Perugia", + "Pescara", + "L'Aquila", + "Campobasso", + "Potenza", + "Cosenza", + "Reggio Calabria", + "Catania", + "Caltanisetta", + "Agrigento", + "La Spezia", + "Modena", + "Vicenza", + "Mantova", + "Cremona", + "Piacenza", + "Reggio Emilia", + "Foggia", + "Benevento", + "Salerno", + "Catanzaro", + "Lecce", + "Como", + "Lecco", + "Sondrio", + "Trento", + "Desenzano", + "Cuneo", + "Asti", + "Lodi", + "Novara", + "Biella", + "Vercelli", + "Rieti", + "Nuoro", + "Oristano", + "Matera", + "Taranto", + "Varese", + "Bergamo", + "Pavia", + "Caserta", + "Frosinone", + "Latina", + "Enna", + "Ragusa", + "Siracusa", + "Pordenone", + "Imperia", + "Verbania", + "Alessandria", + "Messina", + "Siena", + "Arezzo", + "Grosseto", +}; + +static const char * const _name_italian_pref[] = { + "Alpe ", + "Borgo ", + "Cascina ", + "Castel ", + "Fonte ", + "Forte ", + "Malga ", + "Pieve ", + "Poggio ", + "Rocca ", + "Villa ", + "Villar ", +}; + +static const char * const _name_italian_1m[] = { + "Bel", + "Borgo", + "Bosco", + "Campo", + "Capo", + "Casal", + "Castel", + "Colle", + "Fiume", + "Fonte", + "Lago", + "Mezzo", + "Monte", + "Mon", + "Orto", + "Passo", + "Prato", + "Poggio", + "Ponte", + "Pozzo", + "Sasso", + "Tra", + "Tre", + "Ver", + "Vico", +}; + +static const char * const _name_italian_1f[] = { + "Acqua", + "Bra", + "Cala", + "Casa", + "Chiesa", + "Citta", + "Civita", + "Corte", + "Costa", + "Croce", + "Fontana", + "Grotta", + "Guardia", + "Mezza", + "Palma", + "Pietra", + "Ripa", + "Rocca", + "Serra", + "Torre", + "Val", + "Valle", + "Villa", +}; + +static const char * const _name_italian_2[] = { + "bell", + "bianc", + "cald", + "chiar", + "cort", + "ferrat", + "fier", + "fredd", + "gioios", + "grec", + "guzz", + "lung", + "long", + "migli", + "negr", + "ner", + "nov", + "nuov", + "ross", + "rotond", + "scur", + "secc", + "sett", + "vecchi", + "ventos", + "vers", + "viv", +}; + +static const char * const _name_italian_2i[] = { + "", + "breve", + "brevi", + "chiari", + "ferro", + "fieschi", + "fiore", + "fonte", + "forte", + "gate", + "leone", + "maggiore", + "minore", + "mole", + "monte", + "poli", + "scuri", + "terra", + "te", + "torrione", + "vento", + "verde", + "versiere", +}; + + +static const char * const _name_italian_3[] = { + " Marittimo", + " Marittima", + " del Capo", + " del Monte", + " di Sopra", + " di Sotto", + " sui Monti", + " dei Marmi", + " dei Sassi", + " delle Fonti", + " sui Prati", + " a Mare", + " Superiore", + " Inferiore", + " Terme", + " Alta", + " Bassa", + " Brianza", + " Vesuviano", + " Scrivia", + " Ticino", +}; + +static const char * const _name_italian_river1[] = { + " del", + " sul", + " al", + " nel", +}; + +static const char * const _name_italian_river2[] = { + "l'Adda", + "l'Adige", + "le Alpi", + "l'Arno", + " Bormida", + " Brenta", + "la Dora Baltea", + " Lambro", + " Mincio", + " Naviglio", + "l'Oglio", + "l'Olona", + "l'Ombrone", + " Panaro", + " Piave", + " Po", + " Reno", + " Scrivia", + " Secchia", + " Serio", + " Tagliamento", + " Tanaro", + " Taro", + " Ticino", + " Tevere", +}; + +static const char * const _name_catalan_real[] = { + "Barcelona", + "Hospitalet", + "Cerdanyola", + "Martorell", + "Badalona", + "Tarragona", + "Lleida", + "Girona", + "Sabadell", + "Terrassa", + "Reus", + "Valls", + "Vic", + "Vielha", + "Amposta", + "Tortosa", + "Berga", + "Olot", + "Mollerussa", + "Banyoles", + "Figueres", + "Balaguer", + "Vilafranca del Pened\xC3\xA8s", + "La seu d'Urgell", + "Pont de Suert", + "Igualada", + "Manresa", + "Solsona", + "Les borges blanques", + "Tremp", + "Sort", + "Colera", + "Portbou", + "El Vendrell", + "Falset", + "Ripoll", + "Cervera", + "Gandesa", + "Matar\xC3\xB3", + "Montblanc", + "Vilanova i la Geltr\xC3\xBA", + "T\xC3\xA0rrega", + "Camprodon", + "Campdev\xC3\xA0nol", + "Cambrils", + "Begur", + "Set Cases", + "Palafrugell", + "Begues", + "El Bruc", + "Cadaqu\xC3\xA9s", + "Collbat\xC3\xB3", + "Cervell\xC3\xB3", + "Esparraguera", + "Abrera", + "Alp", + "Das", + "Cercs", + "Manlleu", + "Masnou", + "Molins de rei", + "Monistrol", + "Rocallaura", + "Rub\xC3\xAD", + "Ripollet", + "Sitges", + "Roses", +}; + +static const char * const _name_catalan_pref[] = { + "Pont de ", + "Parets de ", + "Canet de ", + "Castellar de ", + "Corbera de ", + "Arenys de ", + "Calella de ", + "La seu de ", + "La bisbal de ", + "Torroella de ", + "Port de ", + "Vilafranca de ", + "Vilanova de ", + "Caldes de ", + "La Conca de ", + "Olesa de ", + "La Roca de ", + "Sant Esteve de ", + "Sant Andreu de ", + "Sant Jordi de ", + "Sant Joan de ", + "Sant Feliu de ", + "Sant Quirze de ", + "Sant Sadurn\xC3\xAD de ", + "Santa Coloma de ", + "Santa Margarida de ", + "Santa Maria de ", + "Sant Mart\xC3\xAD de ", + "Sant Pere de ", + "Sant Juli\xC3\xA0 de ", + "Sant Vicen\xC3\xA7 de ", + +}; + +static const char * const _name_catalan_1m[] = { + "Torrent", + "Cami", + "Mont", + "Bell", + "Puig", + "Riu", +}; + +static const char * const _name_catalan_1f[] = { + "Aigua", + "Selva ", + "Vall", + "Serra", + "Torre", + "Riba", + "Vall", + "Terra", +}; + +static const char * const _name_catalan_2m[] = { + "alt", + "baix", + "fosc", + "pelat", + "vent\xC3\xB3s", + "negre", + "roig", + "gris", +}; + +static const char * const _name_catalan_2f[] = { + "baixa", + "alta", + "fosca", + "clara", + "negra", + "roja", + "grisa", + "freda", +}; + +static const char * const _name_catalan_3[] = { + " desp\xC3\xAD", + " desvern", + " del cam\xC3\xAD", + " de Mar", + " de Dalt", + " de Baix", + " del Vall\xC3\xA8s", + " de Bergued\xC3\xA0", + " de Conflent", + " de la plana", +}; + +static const char * const _name_catalan_river1[] = { + " d'Anoia", + " de Ter", + " de Llobregat", + " d'Ebre", + " de Segre", + " de Francol\xC3\xAD", +}; diff --git a/src/townname.cpp b/src/townname.cpp new file mode 100644 index 000000000..ec63267b8 --- /dev/null +++ b/src/townname.cpp @@ -0,0 +1,936 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file townname.cpp Town name generators. */ + +#include "stdafx.h" +#include "townname_func.h" +#include "string_func.h" +#include "core/alloc_func.hpp" + +#include "table/townname.h" + + +/** + * Generates a number from given seed. + * @param shift_by number of bits seed is shifted to the right + * @param max generated number is in interval 0...max-1 + * @param seed seed + * @return seed transformed to a number from given range + */ +static inline uint32 SeedChance(byte shift_by, int max, uint32 seed) +{ + return (GB(seed, shift_by, 16) * max) >> 16; +} + + +/** + * Generates a number from given seed. Uses different algorithm than SeedChance(). + * @param shift_by number of bits seed is shifted to the right + * @param max generated number is in interval 0...max-1 + * @param seed seed + * @return seed transformed to a number from given range + */ +static inline uint32 SeedModChance(byte shift_by, int max, uint32 seed) +{ + /* This actually gives *MUCH* more even distribution of the values + * than SeedChance(), which is absolutely horrible in that. If + * you do not believe me, try with i.e. the Czech town names, + * compare the words (nicely visible on prefixes) generated by + * SeedChance() and SeedModChance(). Do not get dicouraged by the + * never-use-modulo myths, which hold true only for the linear + * congruential generators (and Random() isn't such a generator). + * --pasky + * TODO: Perhaps we should use it for all the name generators? --pasky */ + return (seed >> shift_by) % max; +} + + +/** + * Generates a number from given seed. + * @param shift_by number of bits seed is shifted to the right + * @param max generated number is in interval -bias...max-1 + * @param seed seed + * @param bias minimum value that can be returned + * @return seed transformed to a number from given range + */ +static inline int32 SeedChanceBias(byte shift_by, int max, uint32 seed, int bias) +{ + return SeedChance(shift_by, max + bias, seed) - bias; +} + + +/** + * Replaces a string beginning in 'org' with 'rep'. + * @param org string to replace, has to be 4 characters long + * @param rep string to be replaced with, has to be 4 characters long + * @param buf buffer with string + */ +static void ReplaceWords(const char *org, const char *rep, char *buf) +{ + if (strncmp(buf, org, 4) == 0) strncpy(buf, rep, 4); // Safe as the string in buf is always more than 4 characters long. +} + + +/** + * Replaces english curses and ugly letter combinations by nicer ones. + * @param buf buffer with town name + * @param original English (Original) generator was used + */ +static void ReplaceEnglishWords(char *buf, bool original) +{ + ReplaceWords("Cunt", "East", buf); + ReplaceWords("Slag", "Pits", buf); + ReplaceWords("Slut", "Edin", buf); + if (!original) ReplaceWords("Fart", "Boot", buf); // never happens with 'English (Original)' + ReplaceWords("Drar", "Quar", buf); + ReplaceWords("Dreh", "Bash", buf); + ReplaceWords("Frar", "Shor", buf); + ReplaceWords("Grar", "Aber", buf); + ReplaceWords("Brar", "Over", buf); + ReplaceWords("Wrar", original ? "Inve" : "Stan", buf); +} + +/** + * Generates English (Original) town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeEnglishOriginalTownName(char *buf, const char *last, uint32 seed) +{ + char *orig = buf; + + /* optional first segment */ + int i = SeedChanceBias(0, lengthof(_name_original_english_1), seed, 50); + if (i >= 0) buf = strecpy(buf, _name_original_english_1[i], last); + + /* mandatory middle segments */ + buf = strecpy(buf, _name_original_english_2[SeedChance(4, lengthof(_name_original_english_2), seed)], last); + buf = strecpy(buf, _name_original_english_3[SeedChance(7, lengthof(_name_original_english_3), seed)], last); + buf = strecpy(buf, _name_original_english_4[SeedChance(10, lengthof(_name_original_english_4), seed)], last); + buf = strecpy(buf, _name_original_english_5[SeedChance(13, lengthof(_name_original_english_5), seed)], last); + + /* optional last segment */ + i = SeedChanceBias(15, lengthof(_name_original_english_6), seed, 60); + if (i >= 0) buf = strecpy(buf, _name_original_english_6[i], last); + + /* Ce, Ci => Ke, Ki */ + if (orig[0] == 'C' && (orig[1] == 'e' || orig[1] == 'i')) { + orig[0] = 'K'; + } + + assert(buf - orig >= 4); + ReplaceEnglishWords(orig, true); + + return buf; +} + + +/** + * Generates English (Additional) town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeEnglishAdditionalTownName(char *buf, const char *last, uint32 seed) +{ + char *orig = buf; + + /* optional first segment */ + int i = SeedChanceBias(0, lengthof(_name_additional_english_prefix), seed, 50); + if (i >= 0) buf = strecpy(buf, _name_additional_english_prefix[i], last); + + if (SeedChance(3, 20, seed) >= 14) { + buf = strecpy(buf, _name_additional_english_1a[SeedChance(6, lengthof(_name_additional_english_1a), seed)], last); + } else { + buf = strecpy(buf, _name_additional_english_1b1[SeedChance(6, lengthof(_name_additional_english_1b1), seed)], last); + buf = strecpy(buf, _name_additional_english_1b2[SeedChance(9, lengthof(_name_additional_english_1b2), seed)], last); + if (SeedChance(11, 20, seed) >= 4) { + buf = strecpy(buf, _name_additional_english_1b3a[SeedChance(12, lengthof(_name_additional_english_1b3a), seed)], last); + } else { + buf = strecpy(buf, _name_additional_english_1b3b[SeedChance(12, lengthof(_name_additional_english_1b3b), seed)], last); + } + } + + buf = strecpy(buf, _name_additional_english_2[SeedChance(14, lengthof(_name_additional_english_2), seed)], last); + + /* optional last segment */ + i = SeedChanceBias(15, lengthof(_name_additional_english_3), seed, 60); + if (i >= 0) buf = strecpy(buf, _name_additional_english_3[i], last); + + assert(buf - orig >= 4); + ReplaceEnglishWords(orig, false); + + return buf; +} + + +/** + * Generates Austrian town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeAustrianTownName(char *buf, const char *last, uint32 seed) +{ + /* Bad, Maria, Gross, ... */ + int i = SeedChanceBias(0, lengthof(_name_austrian_a1), seed, 15); + if (i >= 0) buf = strecpy(buf, _name_austrian_a1[i], last); + + int j = 0; + + i = SeedChance(4, 6, seed); + if (i >= 4) { + /* Kaisers-kirchen */ + buf = strecpy(buf, _name_austrian_a2[SeedChance( 7, lengthof(_name_austrian_a2), seed)], last); + buf = strecpy(buf, _name_austrian_a3[SeedChance(13, lengthof(_name_austrian_a3), seed)], last); + } else if (i >= 2) { + /* St. Johann */ + buf = strecpy(buf, _name_austrian_a5[SeedChance( 7, lengthof(_name_austrian_a5), seed)], last); + buf = strecpy(buf, _name_austrian_a6[SeedChance( 9, lengthof(_name_austrian_a6), seed)], last); + j = 1; // More likely to have a " an der " or " am " + } else { + /* Zell */ + buf = strecpy(buf, _name_austrian_a4[SeedChance( 7, lengthof(_name_austrian_a4), seed)], last); + } + + i = SeedChance(1, 6, seed); + if (i >= 4 - j) { + /* an der Donau (rivers) */ + buf = strecpy(buf, _name_austrian_f1[SeedChance(4, lengthof(_name_austrian_f1), seed)], last); + buf = strecpy(buf, _name_austrian_f2[SeedChance(5, lengthof(_name_austrian_f2), seed)], last); + } else if (i >= 2 - j) { + /* am Dachstein (mountains) */ + buf = strecpy(buf, _name_austrian_b1[SeedChance(4, lengthof(_name_austrian_b1), seed)], last); + buf = strecpy(buf, _name_austrian_b2[SeedChance(5, lengthof(_name_austrian_b2), seed)], last); + } + + return buf; +} + + +/** + * Generates German town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeGermanTownName(char *buf, const char *last, uint32 seed) +{ + uint seed_derivative = SeedChance(7, 28, seed); + + /* optional prefix */ + if (seed_derivative == 12 || seed_derivative == 19) { + uint i = SeedChance(2, lengthof(_name_german_pre), seed); + buf = strecpy(buf, _name_german_pre[i], last); + } + + /* mandatory middle segments including option of hardcoded name */ + uint i = SeedChance(3, lengthof(_name_german_real) + lengthof(_name_german_1), seed); + if (i < lengthof(_name_german_real)) { + buf = strecpy(buf, _name_german_real[i], last); + } else { + buf = strecpy(buf, _name_german_1[i - lengthof(_name_german_real)], last); + + i = SeedChance(5, lengthof(_name_german_2), seed); + buf = strecpy(buf, _name_german_2[i], last); + } + + /* optional suffix */ + if (seed_derivative == 24) { + i = SeedChance(9, lengthof(_name_german_4_an_der) + lengthof(_name_german_4_am), seed); + if (i < lengthof(_name_german_4_an_der)) { + buf = strecpy(buf, _name_german_3_an_der[0], last); + buf = strecpy(buf, _name_german_4_an_der[i], last); + } else { + buf = strecpy(buf, _name_german_3_am[0], last); + buf = strecpy(buf, _name_german_4_am[i - lengthof(_name_german_4_an_der)], last); + } + } + + return buf; +} + + +/** + * Generates Latin-American town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeSpanishTownName(char *buf, const char *last, uint32 seed) +{ + return strecpy(buf, _name_spanish_real[SeedChance(0, lengthof(_name_spanish_real), seed)], last); +} + + +/** + * Generates French town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeFrenchTownName(char *buf, const char *last, uint32 seed) +{ + return strecpy(buf, _name_french_real[SeedChance(0, lengthof(_name_french_real), seed)], last); +} + + +/** + * Generates Silly town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeSillyTownName(char *buf, const char *last, uint32 seed) +{ + buf = strecpy(buf, _name_silly_1[SeedChance( 0, lengthof(_name_silly_1), seed)], last); + buf = strecpy(buf, _name_silly_2[SeedChance(16, lengthof(_name_silly_2), seed)], last); + + return buf; +} + + +/** + * Generates Swedish town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeSwedishTownName(char *buf, const char *last, uint32 seed) +{ + /* optional first segment */ + int i = SeedChanceBias(0, lengthof(_name_swedish_1), seed, 50); + if (i >= 0) buf = strecpy(buf, _name_swedish_1[i], last); + + /* mandatory middle segments including option of hardcoded name */ + if (SeedChance(4, 5, seed) >= 3) { + buf = strecpy(buf, _name_swedish_2[SeedChance( 7, lengthof(_name_swedish_2), seed)], last); + } else { + buf = strecpy(buf, _name_swedish_2a[SeedChance( 7, lengthof(_name_swedish_2a), seed)], last); + buf = strecpy(buf, _name_swedish_2b[SeedChance(10, lengthof(_name_swedish_2b), seed)], last); + buf = strecpy(buf, _name_swedish_2c[SeedChance(13, lengthof(_name_swedish_2c), seed)], last); + } + + buf = strecpy(buf, _name_swedish_3[SeedChance(16, lengthof(_name_swedish_3), seed)], last); + + return buf; +} + + +/** + * Generates Dutch town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeDutchTownName(char *buf, const char *last, uint32 seed) +{ + /* optional first segment */ + int i = SeedChanceBias(0, lengthof(_name_dutch_1), seed, 50); + if (i >= 0) buf = strecpy(buf, _name_dutch_1[i], last); + + /* mandatory middle segments including option of hardcoded name */ + if (SeedChance(6, 9, seed) > 4) { + buf = strecpy(buf, _name_dutch_2[SeedChance( 9, lengthof(_name_dutch_2), seed)], last); + } else { + buf = strecpy(buf, _name_dutch_3[SeedChance( 9, lengthof(_name_dutch_3), seed)], last); + buf = strecpy(buf, _name_dutch_4[SeedChance(12, lengthof(_name_dutch_4), seed)], last); + } + + buf = strecpy(buf, _name_dutch_5[SeedChance(15, lengthof(_name_dutch_5), seed)], last); + + return buf; +} + + +/** + * Generates Finnish town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeFinnishTownName(char *buf, const char *last, uint32 seed) +{ + char *orig = buf; + + /* Select randomly if town name should consists of one or two parts. */ + if (SeedChance(0, 15, seed) >= 10) { + return strecpy(buf, _name_finnish_real[SeedChance(2, lengthof(_name_finnish_real), seed)], last); + } + + if (SeedChance(0, 15, seed) >= 5) { + /* A two-part name by combining one of _name_finnish_1 + "la"/"lä" + * The reason for not having the contents of _name_finnish_{1,2} in the same table is + * that the ones in _name_finnish_2 are not good for this purpose. */ + uint sel = SeedChance( 0, lengthof(_name_finnish_1), seed); + buf = strecpy(buf, _name_finnish_1[sel], last); + char *end = buf - 1; + assert(end >= orig); + if (*end == 'i') *end = 'e'; + if (strstr(orig, "a") != NULL || strstr(orig, "o") != NULL || strstr(orig, "u") != NULL || + strstr(orig, "A") != NULL || strstr(orig, "O") != NULL || strstr(orig, "U") != NULL) { + buf = strecpy(buf, "la", last); + } else { + buf = strecpy(buf, "l\xC3\xA4", last); + } + return buf; + } + + /* A two-part name by combining one of _name_finnish_{1,2} + _name_finnish_3. + * Why aren't _name_finnish_{1,2} just one table? See above. */ + uint sel = SeedChance(2, lengthof(_name_finnish_1) + lengthof(_name_finnish_2), seed); + if (sel >= lengthof(_name_finnish_1)) { + buf = strecpy(buf, _name_finnish_2[sel - lengthof(_name_finnish_1)], last); + } else { + buf = strecpy(buf, _name_finnish_1[sel], last); + } + + buf = strecpy(buf, _name_finnish_3[SeedChance(10, lengthof(_name_finnish_3), seed)], last); + + return buf; +} + + +/** + * Generates Polish town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakePolishTownName(char *buf, const char *last, uint32 seed) +{ + /* optional first segment */ + uint i = SeedChance(0, + lengthof(_name_polish_2_o) + lengthof(_name_polish_2_m) + + lengthof(_name_polish_2_f) + lengthof(_name_polish_2_n), + seed); + uint j = SeedChance(2, 20, seed); + + + if (i < lengthof(_name_polish_2_o)) { + return strecpy(buf, _name_polish_2_o[SeedChance(3, lengthof(_name_polish_2_o), seed)], last); + } + + if (i < lengthof(_name_polish_2_m) + lengthof(_name_polish_2_o)) { + if (j < 4) { + buf = strecpy(buf, _name_polish_1_m[SeedChance(5, lengthof(_name_polish_1_m), seed)], last); + } + + buf = strecpy(buf, _name_polish_2_m[SeedChance(7, lengthof(_name_polish_2_m), seed)], last); + + if (j >= 4 && j < 16) { + buf = strecpy(buf, _name_polish_3_m[SeedChance(10, lengthof(_name_polish_3_m), seed)], last); + } + + return buf; + } + + if (i < lengthof(_name_polish_2_f) + lengthof(_name_polish_2_m) + lengthof(_name_polish_2_o)) { + if (j < 4) { + buf = strecpy(buf, _name_polish_1_f[SeedChance(5, lengthof(_name_polish_1_f), seed)], last); + } + + buf = strecpy(buf, _name_polish_2_f[SeedChance(7, lengthof(_name_polish_2_f), seed)], last); + + if (j >= 4 && j < 16) { + buf = strecpy(buf, _name_polish_3_f[SeedChance(10, lengthof(_name_polish_3_f), seed)], last); + } + + return buf; + } + + if (j < 4) { + buf = strecpy(buf, _name_polish_1_n[SeedChance(5, lengthof(_name_polish_1_n), seed)], last); + } + + buf = strecpy(buf, _name_polish_2_n[SeedChance(7, lengthof(_name_polish_2_n), seed)], last); + + if (j >= 4 && j < 16) { + buf = strecpy(buf, _name_polish_3_n[SeedChance(10, lengthof(_name_polish_3_n), seed)], last); + } + + return buf; +} + + +/** + * Generates Czech town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeCzechTownName(char *buf, const char *last, uint32 seed) +{ + /* 1:3 chance to use a real name. */ + if (SeedModChance(0, 4, seed) == 0) { + return strecpy(buf, _name_czech_real[SeedModChance(4, lengthof(_name_czech_real), seed)], last); + } + + const char *orig = buf; + + /* Probability of prefixes/suffixes + * 0..11 prefix, 12..13 prefix+suffix, 14..17 suffix, 18..31 nothing */ + int prob_tails = SeedModChance(2, 32, seed); + bool do_prefix = prob_tails < 12; + bool do_suffix = prob_tails > 11 && prob_tails < 17; + bool dynamic_subst; + + /* IDs of the respective parts */ + int prefix = 0, ending = 0, suffix = 0; + uint postfix = 0; + uint stem; + + /* The select criteria. */ + CzechGender gender; + CzechChoose choose; + CzechAllow allow; + + if (do_prefix) prefix = SeedModChance(5, lengthof(_name_czech_adj) * 12, seed) / 12; + if (do_suffix) suffix = SeedModChance(7, lengthof(_name_czech_suffix), seed); + /* 3:1 chance 3:1 to use dynamic substantive */ + stem = SeedModChance(9, + lengthof(_name_czech_subst_full) + 3 * lengthof(_name_czech_subst_stem), + seed); + if (stem < lengthof(_name_czech_subst_full)) { + /* That was easy! */ + dynamic_subst = false; + gender = _name_czech_subst_full[stem].gender; + choose = _name_czech_subst_full[stem].choose; + allow = _name_czech_subst_full[stem].allow; + } else { + unsigned int map[lengthof(_name_czech_subst_ending)]; + int ending_start = -1, ending_stop = -1; + + /* Load the substantive */ + dynamic_subst = true; + stem -= lengthof(_name_czech_subst_full); + stem %= lengthof(_name_czech_subst_stem); + gender = _name_czech_subst_stem[stem].gender; + choose = _name_czech_subst_stem[stem].choose; + allow = _name_czech_subst_stem[stem].allow; + + /* Load the postfix (1:1 chance that a postfix will be inserted) */ + postfix = SeedModChance(14, lengthof(_name_czech_subst_postfix) * 2, seed); + + if (choose & CZC_POSTFIX) { + /* Always get a real postfix. */ + postfix %= lengthof(_name_czech_subst_postfix); + } + if (choose & CZC_NOPOSTFIX) { + /* Always drop a postfix. */ + postfix += lengthof(_name_czech_subst_postfix); + } + if (postfix < lengthof(_name_czech_subst_postfix)) { + choose |= CZC_POSTFIX; + } else { + choose |= CZC_NOPOSTFIX; + } + + /* Localize the array segment containing a good gender */ + for (ending = 0; ending < (int)lengthof(_name_czech_subst_ending); ending++) { + const CzechNameSubst *e = &_name_czech_subst_ending[ending]; + + if (gender == CZG_FREE || + (gender == CZG_NFREE && e->gender != CZG_SNEUT && e->gender != CZG_PNEUT) || + gender == e->gender) { + if (ending_start < 0) { + ending_start = ending; + } + } else if (ending_start >= 0) { + ending_stop = ending - 1; + break; + } + } + if (ending_stop < 0) { + /* Whoa. All the endings matched. */ + ending_stop = ending - 1; + } + + /* Make a sequential map of the items with good mask */ + size_t i = 0; + for (ending = ending_start; ending <= ending_stop; ending++) { + const CzechNameSubst *e = &_name_czech_subst_ending[ending]; + + if ((e->choose & choose) == choose && (e->allow & allow) != 0) { + map[i++] = ending; + } + } + assert(i > 0); + + /* Load the ending */ + ending = map[SeedModChance(16, (int)i, seed)]; + /* Override possible CZG_*FREE; this must be a real gender, + * otherwise we get overflow when modifying the adjectivum. */ + gender = _name_czech_subst_ending[ending].gender; + assert(gender != CZG_FREE && gender != CZG_NFREE); + } + + if (do_prefix && (_name_czech_adj[prefix].choose & choose) != choose) { + /* Throw away non-matching prefix. */ + do_prefix = false; + } + + /* Now finally construct the name */ + if (do_prefix) { + CzechPattern pattern = _name_czech_adj[prefix].pattern; + + buf = strecpy(buf, _name_czech_adj[prefix].name, last); + + char *endpos = buf - 1; + /* Find the first character in a UTF-8 sequence */ + while (GB(*endpos, 6, 2) == 2) endpos--; + + if (gender == CZG_SMASC && pattern == CZP_PRIVL) { + assert(endpos >= orig + 2); + /* -ovX -> -uv */ + *(endpos - 2) = 'u'; + assert(*(endpos - 1) == 'v'); + *endpos = '\0'; + } else { + assert(endpos >= orig); + endpos = strecpy(endpos, _name_czech_patmod[gender][pattern], last); + } + + buf = strecpy(endpos, " ", last); + } + + if (dynamic_subst) { + buf = strecpy(buf, _name_czech_subst_stem[stem].name, last); + if (postfix < lengthof(_name_czech_subst_postfix)) { + const char *poststr = _name_czech_subst_postfix[postfix]; + const char *endstr = _name_czech_subst_ending[ending].name; + + size_t postlen = strlen(poststr); + size_t endlen = strlen(endstr); + assert(postlen > 0 && endlen > 0); + + /* Kill the "avava" and "Jananna"-like cases */ + if (postlen < 2 || postlen > endlen || + ((poststr[1] != 'v' || poststr[1] != endstr[1]) && + poststr[2] != endstr[1])) { + buf = strecpy(buf, poststr, last); + + /* k-i -> c-i, h-i -> z-i */ + if (endstr[0] == 'i') { + switch (*(buf - 1)) { + case 'k': *(buf - 1) = 'c'; break; + case 'h': *(buf - 1) = 'z'; break; + default: break; + } + } + } + } + buf = strecpy(buf, _name_czech_subst_ending[ending].name, last); + } else { + buf = strecpy(buf, _name_czech_subst_full[stem].name, last); + } + + if (do_suffix) { + buf = strecpy(buf, " ", last); + buf = strecpy(buf, _name_czech_suffix[suffix], last); + } + + return buf; +} + + +/** + * Generates Romanian town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeRomanianTownName(char *buf, const char *last, uint32 seed) +{ + return strecpy(buf, _name_romanian_real[SeedChance(0, lengthof(_name_romanian_real), seed)], last); +} + + +/** + * Generates Slovak town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeSlovakTownName(char *buf, const char *last, uint32 seed) +{ + return strecpy(buf, _name_slovak_real[SeedChance(0, lengthof(_name_slovak_real), seed)], last); +} + + +/** + * Generates Norwegian town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeNorwegianTownName(char *buf, const char *last, uint32 seed) +{ + /* Use first 4 bit from seed to decide whether or not this town should + * have a real name 3/16 chance. Bit 0-3 */ + if (SeedChance(0, 15, seed) < 3) { + /* Use 7bit for the realname table index. Bit 4-10 */ + return strecpy(buf, _name_norwegian_real[SeedChance(4, lengthof(_name_norwegian_real), seed)], last); + } + + /* Use 7bit for the first fake part. Bit 4-10 */ + buf = strecpy(buf, _name_norwegian_1[SeedChance(4, lengthof(_name_norwegian_1), seed)], last); + /* Use 7bit for the last fake part. Bit 11-17 */ + buf = strecpy(buf, _name_norwegian_2[SeedChance(11, lengthof(_name_norwegian_2), seed)], last); + + return buf; +} + + +/** + * Generates Hungarian town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeHungarianTownName(char *buf, const char *last, uint32 seed) +{ + if (SeedChance(12, 15, seed) < 3) { + return strecpy(buf, _name_hungarian_real[SeedChance(0, lengthof(_name_hungarian_real), seed)], last); + } + + /* optional first segment */ + uint i = SeedChance(3, lengthof(_name_hungarian_1) * 3, seed); + if (i < lengthof(_name_hungarian_1)) buf = strecpy(buf, _name_hungarian_1[i], last); + + /* mandatory middle segments */ + buf = strecpy(buf, _name_hungarian_2[SeedChance(3, lengthof(_name_hungarian_2), seed)], last); + buf = strecpy(buf, _name_hungarian_3[SeedChance(6, lengthof(_name_hungarian_3), seed)], last); + + /* optional last segment */ + i = SeedChance(10, lengthof(_name_hungarian_4) * 3, seed); + if (i < lengthof(_name_hungarian_4)) { + buf = strecpy(buf, _name_hungarian_4[i], last); + } + + return buf; +} + + +/** + * Generates Swiss town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeSwissTownName(char *buf, const char *last, uint32 seed) +{ + return strecpy(buf, _name_swiss_real[SeedChance(0, lengthof(_name_swiss_real), seed)], last); +} + + +/** + * Generates Danish town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeDanishTownName(char *buf, const char *last, uint32 seed) +{ + /* optional first segment */ + int i = SeedChanceBias(0, lengthof(_name_danish_1), seed, 50); + if (i >= 0) buf = strecpy(buf, _name_danish_1[i], last); + + /* middle segments removed as this algorithm seems to create much more realistic names */ + buf = strecpy(buf, _name_danish_2[SeedChance( 7, lengthof(_name_danish_2), seed)], last); + buf = strecpy(buf, _name_danish_3[SeedChance(16, lengthof(_name_danish_3), seed)], last); + + return buf; +} + + +/** + * Generates Turkish town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeTurkishTownName(char *buf, const char *last, uint32 seed) +{ + uint i = SeedModChance(0, 5, seed); + + switch (i) { + case 0: + buf = strecpy(buf, _name_turkish_prefix[SeedModChance( 2, lengthof(_name_turkish_prefix), seed)], last); + + /* middle segment */ + buf = strecpy(buf, _name_turkish_middle[SeedModChance( 4, lengthof(_name_turkish_middle), seed)], last); + + /* optional suffix */ + if (SeedModChance(0, 7, seed) == 0) { + buf = strecpy(buf, _name_turkish_suffix[SeedModChance( 10, lengthof(_name_turkish_suffix), seed)], last); + } + break; + + case 1: case 2: + buf = strecpy(buf, _name_turkish_prefix[SeedModChance( 2, lengthof(_name_turkish_prefix), seed)], last); + buf = strecpy(buf, _name_turkish_suffix[SeedModChance( 4, lengthof(_name_turkish_suffix), seed)], last); + break; + + default: + buf = strecpy(buf, _name_turkish_real[SeedModChance( 4, lengthof(_name_turkish_real), seed)], last); + break; + } + + return buf; +} + + +/** + * Generates Italian town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeItalianTownName(char *buf, const char *last, uint32 seed) +{ + if (SeedModChance(0, 6, seed) == 0) { // real city names + return strecpy(buf, _name_italian_real[SeedModChance(4, lengthof(_name_italian_real), seed)], last); + } + + static const char * const mascul_femin_italian[] = { + "o", + "a", + }; + + if (SeedModChance(0, 8, seed) == 0) { // prefix + buf = strecpy(buf, _name_italian_pref[SeedModChance(11, lengthof(_name_italian_pref), seed)], last); + } + + uint i = SeedChance(0, 2, seed); + if (i == 0) { // masculine form + buf = strecpy(buf, _name_italian_1m[SeedModChance(4, lengthof(_name_italian_1m), seed)], last); + } else { // feminine form + buf = strecpy(buf, _name_italian_1f[SeedModChance(4, lengthof(_name_italian_1f), seed)], last); + } + + if (SeedModChance(3, 3, seed) == 0) { + buf = strecpy(buf, _name_italian_2[SeedModChance(11, lengthof(_name_italian_2), seed)], last); + buf = strecpy(buf, mascul_femin_italian[i], last); + } else { + buf = strecpy(buf, _name_italian_2i[SeedModChance(16, lengthof(_name_italian_2i), seed)], last); + } + + if (SeedModChance(15, 4, seed) == 0) { + if (SeedModChance(5, 2, seed) == 0) { // generic suffix + buf = strecpy(buf, _name_italian_3[SeedModChance(4, lengthof(_name_italian_3), seed)], last); + } else { // river name suffix + buf = strecpy(buf, _name_italian_river1[SeedModChance(4, lengthof(_name_italian_river1), seed)], last); + buf = strecpy(buf, _name_italian_river2[SeedModChance(16, lengthof(_name_italian_river2), seed)], last); + } + } + + return buf; +} + + +/** + * Generates Catalan town name from given seed. + * @param buf output buffer + * @param seed town name seed + * @param last end of buffer + */ +static char *MakeCatalanTownName(char *buf, const char *last, uint32 seed) +{ + if (SeedModChance(0, 3, seed) == 0) { // real city names + return strecpy(buf, _name_catalan_real[SeedModChance(4, lengthof(_name_catalan_real), seed)], last); + } + + if (SeedModChance(0, 2, seed) == 0) { // prefix + buf = strecpy(buf, _name_catalan_pref[SeedModChance(11, lengthof(_name_catalan_pref), seed)], last); + } + + uint i = SeedChance(0, 2, seed); + if (i == 0) { // masculine form + buf = strecpy(buf, _name_catalan_1m[SeedModChance(4, lengthof(_name_catalan_1m), seed)], last); + buf = strecpy(buf, _name_catalan_2m[SeedModChance(11, lengthof(_name_catalan_2m), seed)], last); + } else { // feminine form + buf = strecpy(buf, _name_catalan_1f[SeedModChance(4, lengthof(_name_catalan_1f), seed)], last); + buf = strecpy(buf, _name_catalan_2f[SeedModChance(11, lengthof(_name_catalan_2f), seed)], last); + } + + if (SeedModChance(15, 5, seed) == 0) { + if (SeedModChance(5, 2, seed) == 0) { // generic suffix + buf = strecpy(buf, _name_catalan_3[SeedModChance(4, lengthof(_name_catalan_3), seed)], last); + } else { // river name suffix + buf = strecpy(buf, _name_catalan_river1[SeedModChance(4, lengthof(_name_catalan_river1), seed)], last); + } + } + + return buf; +} + + +typedef char *TownNameGenerator(char *buf, const char *last, uint32 seed); + +/** Contains pointer to generator and minimum buffer size (not incl. terminating '\0') */ +struct TownNameGeneratorParams { + byte min; ///< minimum number of characters that need to be printed for generator to work correctly + TownNameGenerator *proc; ///< generator itself +}; + +/** Town name generators */ +static const TownNameGeneratorParams _town_name_generators[] = { + { 4, MakeEnglishOriginalTownName}, // replaces first 4 characters of name + { 0, MakeFrenchTownName}, + { 0, MakeGermanTownName}, + { 4, MakeEnglishAdditionalTownName}, // replaces first 4 characters of name + { 0, MakeSpanishTownName}, + { 0, MakeSillyTownName}, + { 0, MakeSwedishTownName}, + { 0, MakeDutchTownName}, + { 8, MakeFinnishTownName}, // _name_finnish_1 + { 0, MakePolishTownName}, + { 0, MakeSlovakTownName}, + { 0, MakeNorwegianTownName}, + { 0, MakeHungarianTownName}, + { 0, MakeAustrianTownName}, + { 0, MakeRomanianTownName}, + { 28, MakeCzechTownName}, // _name_czech_adj + _name_czech_patmod + 1 + _name_czech_subst_stem + _name_czech_subst_postfix + { 0, MakeSwissTownName}, + { 0, MakeDanishTownName}, + { 0, MakeTurkishTownName}, + { 0, MakeItalianTownName}, + { 0, MakeCatalanTownName}, +}; + + +/** + * Generates town name from given seed. a language. + * @param buf output buffer + * @param last end of buffer + * @param lang town name language + * @param seed generation seed + * @return last character ('/0') + */ +char *GenerateTownNameString(char *buf, const char *last, size_t lang, uint32 seed) +{ + assert(lang < lengthof(_town_name_generators)); + + /* Some generators need at least 9 bytes in buffer. English generators need 5 for + * string replacing, others use constructions like strlen(buf)-3 and so on. + * Finnish generator needs to fit all strings from _name_finnish_1. + * Czech generator needs to fit almost whole town name... + * These would break. Using another temporary buffer results in ~40% slower code, + * so use it only when really needed. */ + const TownNameGeneratorParams *par = &_town_name_generators[lang]; + if (last >= buf + par->min) return par->proc(buf, last, seed); + + char *buffer = AllocaM(char, par->min + 1); + par->proc(buffer, buffer + par->min, seed); + + return strecpy(buf, buffer, last); +} diff --git a/src/townname_func.h b/src/townname_func.h new file mode 100644 index 000000000..d0e2da77c --- /dev/null +++ b/src/townname_func.h @@ -0,0 +1,17 @@ +/* $Id$ */ + +/* + * This file is part of OpenTTD. + * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. + * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see . + */ + +/** @file townname_func.h Town name generator stuff. */ + +#ifndef NAMEGEN_FUNC_H +#define NAMEGEN_FUNC_H + +char *GenerateTownNameString(char *buf, const char *last, size_t lang, uint32 seed); + +#endif /* NAMEGEN_FUNC_H */ -- cgit v1.2.3-70-g09d2