namegen.c
changeset 3698 2f256fe23db9
parent 3106 5e3711f21be7
child 4077 d4d440dd8925
equal deleted inserted replaced
3697:ed277943a0fc 3698:2f256fe23db9
   615 
   615 
   616 	// middle segments removed as this algorithm seems to create much more realistic names
   616 	// middle segments removed as this algorithm seems to create much more realistic names
   617 	strcat(buf, name_danish_2[SeedChance( 7, lengthof(name_danish_2), seed)]);
   617 	strcat(buf, name_danish_2[SeedChance( 7, lengthof(name_danish_2), seed)]);
   618 	strcat(buf, name_danish_3[SeedChance(16, lengthof(name_danish_3), seed)]);
   618 	strcat(buf, name_danish_3[SeedChance(16, lengthof(name_danish_3), seed)]);
   619 
   619 
       
   620 	return 0;
       
   621 }
       
   622 
       
   623 static byte MakeTurkishTownName(char *buf, uint32 seed)
       
   624 {
       
   625 	uint i;
       
   626 
       
   627 	// null terminates the string for strcat
       
   628 	strcpy(buf, "");
       
   629 
       
   630 	if ((i = SeedModChance(0, 5, seed)) == 0) {
       
   631 		strcat(buf, name_turkish_prefix[SeedModChance( 2, lengthof(name_turkish_prefix), seed)]);
       
   632 
       
   633 		// middle segment
       
   634 		strcat(buf, name_turkish_middle[SeedModChance( 4, lengthof(name_turkish_middle), seed)]);
       
   635 
       
   636 		// optional suffix
       
   637 		if (SeedModChance(0, 7, seed) == 0) {
       
   638 			strcat(buf, name_turkish_suffix[SeedModChance( 10, lengthof(name_turkish_suffix), seed)]);
       
   639 		}
       
   640 	} else {
       
   641 		if (i == 1 || i == 2) {
       
   642 			strcat(buf, name_turkish_prefix[SeedModChance( 2, lengthof(name_turkish_prefix), seed)]);
       
   643 			strcat(buf, name_turkish_suffix[SeedModChance( 4, lengthof(name_turkish_suffix), seed)]);
       
   644 		} else {
       
   645 			strcat(buf, name_turkish_real[SeedModChance( 4, lengthof(name_turkish_real), seed)]);
       
   646 		}
       
   647 	}
   620 	return 0;
   648 	return 0;
   621 }
   649 }
   622 
   650 
   623 TownNameGenerator * const _town_name_generators[] =
   651 TownNameGenerator * const _town_name_generators[] =
   624 {
   652 {
   638 	MakeAustrianTownName,
   666 	MakeAustrianTownName,
   639 	MakeRomanianTownName,
   667 	MakeRomanianTownName,
   640 	MakeCzechTownName,
   668 	MakeCzechTownName,
   641 	MakeSwissTownName,
   669 	MakeSwissTownName,
   642 	MakeDanishTownName,
   670 	MakeDanishTownName,
       
   671 	MakeTurkishTownName,
   643 };
   672 };
   644 
   673 
   645 // DO WE NEED THIS ANY MORE?
   674 // DO WE NEED THIS ANY MORE?
   646 #define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z)
   675 #define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z)
   647 
   676