src/namegen.cpp
branchcpp_gui
changeset 6308 646711c5feaa
parent 6303 84c215fc8eb8
child 6872 1c4a4a609f85
child 9723 eee46cb39750
equal deleted inserted replaced
6307:f40e88cff863 6308:646711c5feaa
    88 	strecpy(buf, "", last);
    88 	strecpy(buf, "", last);
    89 
    89 
    90 	/* optional first segment */
    90 	/* optional first segment */
    91 	i = SeedChanceBias(0, lengthof(name_additional_english_prefix), seed, 50);
    91 	i = SeedChanceBias(0, lengthof(name_additional_english_prefix), seed, 50);
    92 	if (i >= 0)
    92 	if (i >= 0)
    93 		strecat(buf,name_additional_english_prefix[i], last);
    93 		strecat(buf, name_additional_english_prefix[i], last);
    94 
    94 
    95 	if (SeedChance(3, 20, seed) >= 14) {
    95 	if (SeedChance(3, 20, seed) >= 14) {
    96 		strecat(buf, name_additional_english_1a[SeedChance(6, lengthof(name_additional_english_1a), seed)], last);
    96 		strecat(buf, name_additional_english_1a[SeedChance(6, lengthof(name_additional_english_1a), seed)], last);
    97 	} else {
    97 	} else {
    98 		strecat(buf, name_additional_english_1b1[SeedChance(6, lengthof(name_additional_english_1b1), seed)], last);
    98 		strecat(buf, name_additional_english_1b1[SeedChance(6, lengthof(name_additional_english_1b1), seed)], last);
   174 	seed_derivative = SeedChance(7, 28, seed);
   174 	seed_derivative = SeedChance(7, 28, seed);
   175 
   175 
   176 	/* optional prefix */
   176 	/* optional prefix */
   177 	if (seed_derivative == 12 || seed_derivative == 19) {
   177 	if (seed_derivative == 12 || seed_derivative == 19) {
   178 		i = SeedChance(2, lengthof(name_german_pre), seed);
   178 		i = SeedChance(2, lengthof(name_german_pre), seed);
   179 		strecat(buf,name_german_pre[i], last);
   179 		strecat(buf, name_german_pre[i], last);
   180 	}
   180 	}
   181 
   181 
   182 	/* mandatory middle segments including option of hardcoded name */
   182 	/* mandatory middle segments including option of hardcoded name */
   183 	i = SeedChance(3, lengthof(name_german_real) + lengthof(name_german_1), seed);
   183 	i = SeedChance(3, lengthof(name_german_real) + lengthof(name_german_1), seed);
   184 	if (i < lengthof(name_german_real)) {
   184 	if (i < lengthof(name_german_real)) {
   185 		strecat(buf,name_german_real[i], last);
   185 		strecat(buf, name_german_real[i], last);
   186 	} else {
   186 	} else {
   187 		strecat(buf, name_german_1[i - lengthof(name_german_real)], last);
   187 		strecat(buf, name_german_1[i - lengthof(name_german_real)], last);
   188 
   188 
   189 		i = SeedChance(5, lengthof(name_german_2), seed);
   189 		i = SeedChance(5, lengthof(name_german_2), seed);
   190 		strecat(buf, name_german_2[i], last);
   190 		strecat(buf, name_german_2[i], last);
   281 
   281 
   282 	/* Select randomly if town name should consists of one or two parts. */
   282 	/* Select randomly if town name should consists of one or two parts. */
   283 	if (SeedChance(0, 15, seed) >= 10) {
   283 	if (SeedChance(0, 15, seed) >= 10) {
   284 		strecat(buf, name_finnish_real[SeedChance(2, lengthof(name_finnish_real), seed)], last);
   284 		strecat(buf, name_finnish_real[SeedChance(2, lengthof(name_finnish_real), seed)], last);
   285 	} else if (SeedChance(0, 15, seed) >= 5) {
   285 	} else if (SeedChance(0, 15, seed) >= 5) {
   286 		/* A two-part name by combining one of name_finnish_1 + "la"/"lä"
   286 		/* A two-part name by combining one of name_finnish_1 + "la"/"lä"
   287 		 * The reason for not having the contents of name_finnish_{1,2} in the same table is
   287 		 * The reason for not having the contents of name_finnish_{1,2} in the same table is
   288 		 * that the ones in name_finnish_2 are not good for this purpose. */
   288 		 * that the ones in name_finnish_2 are not good for this purpose. */
   289 		uint sel = SeedChance( 0, lengthof(name_finnish_1), seed);
   289 		uint sel = SeedChance( 0, lengthof(name_finnish_1), seed);
   290 		char *end;
   290 		char *end;
   291 		strecat(buf, name_finnish_1[sel], last);
   291 		strecat(buf, name_finnish_1[sel], last);
   295 		if (strstr(buf, "a") || strstr(buf, "o") || strstr(buf, "u") ||
   295 		if (strstr(buf, "a") || strstr(buf, "o") || strstr(buf, "u") ||
   296 			strstr(buf, "A") || strstr(buf, "O") || strstr(buf, "U"))
   296 			strstr(buf, "A") || strstr(buf, "O") || strstr(buf, "U"))
   297 		{
   297 		{
   298 			strecat(buf, "la", last);
   298 			strecat(buf, "la", last);
   299 		} else {
   299 		} else {
   300 			strecat(buf, "lä", last);
   300 			strecat(buf, "lä", last);
   301 		}
   301 		}
   302 	} else {
   302 	} else {
   303 		/* A two-part name by combining one of name_finnish_{1,2} + name_finnish_3.
   303 		/* A two-part name by combining one of name_finnish_{1,2} + name_finnish_3.
   304 		 * Why aren't name_finnish_{1,2} just one table? See above. */
   304 		 * Why aren't name_finnish_{1,2} just one table? See above. */
   305 		uint sel = SeedChance(2,
   305 		uint sel = SeedChance(2,
   677 			strecat(buf, name_italian_1f[SeedModChance(4, lengthof(name_italian_1f), seed)], last);
   677 			strecat(buf, name_italian_1f[SeedModChance(4, lengthof(name_italian_1f), seed)], last);
   678 		}
   678 		}
   679 
   679 
   680 		if (SeedModChance(3, 3, seed) == 0) {
   680 		if (SeedModChance(3, 3, seed) == 0) {
   681 			strecat(buf, name_italian_2[SeedModChance(11, lengthof(name_italian_2), seed)], last);
   681 			strecat(buf, name_italian_2[SeedModChance(11, lengthof(name_italian_2), seed)], last);
   682 			strecat(buf,mascul_femin_italian[i], last);
   682 			strecat(buf, mascul_femin_italian[i], last);
   683 		} else {
   683 		} else {
   684 			strecat(buf, name_italian_2i[SeedModChance(16, lengthof(name_italian_2i), seed)], last);
   684 			strecat(buf, name_italian_2i[SeedModChance(16, lengthof(name_italian_2i), seed)], last);
   685 		}
   685 		}
   686 
   686 
   687 		if (SeedModChance(15, 4, seed) == 0) {
   687 		if (SeedModChance(15, 4, seed) == 0) {