summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbjarni <bjarni@openttd.org>2006-08-20 09:52:15 +0000
committerbjarni <bjarni@openttd.org>2006-08-20 09:52:15 +0000
commitdb39da587f4ab98734cd1503f6c6bc45a43229a5 (patch)
tree907ba4f3b1c8d8230dbc80806da5e7c1221eee5a
parent5513c6997fc98c45b7d6ef65537c4fb0daab998a (diff)
downloadopenttd-db39da587f4ab98734cd1503f6c6bc45a43229a5.tar.xz
(svn r5965) -Feature: FS#261 Catalan Town Names generator (arnau)
-rw-r--r--lang/english.txt1
-rw-r--r--namegen.c38
-rw-r--r--openttd.h3
-rw-r--r--settings.c2
-rw-r--r--table/namegen.h169
5 files changed, 211 insertions, 2 deletions
diff --git a/lang/english.txt b/lang/english.txt
index f8f649339..09f091d8e 100644
--- a/lang/english.txt
+++ b/lang/english.txt
@@ -885,6 +885,7 @@ STR_TOWNNAME_SWISS :Swiss
STR_TOWNNAME_DANISH :Danish
STR_TOWNNAME_TURKISH :Turkish
STR_TOWNNAME_ITALIAN :Italian
+STR_TOWNNAME_CATALAN :Catalan
############ end of townname region
STR_CURR_GBP :Pounds (£)
diff --git a/namegen.c b/namegen.c
index b0f81e0de..44e347452 100644
--- a/namegen.c
+++ b/namegen.c
@@ -692,6 +692,43 @@ static byte MakeItalianTownName(char *buf, uint32 seed) {
return 0;
}
+static byte MakeCatalanTownName(char *buf, uint32 seed) {
+
+ strcpy(buf, "");
+
+ if (SeedModChance(0, 3, seed) == 0) { // real city names
+ strcat(buf, name_catalan_real[SeedModChance(4, lengthof(name_catalan_real), seed)]);
+ } else {
+ uint i;
+ if (SeedModChance(0, 2, seed) == 0) { // prefix
+ strcat(buf, name_catalan_pref[SeedModChance(11, lengthof(name_catalan_pref), seed)]);
+ }
+ else {
+ i = SeedChance(0, 2, seed);
+ if (i == 0) { // masculine form
+ strcat(buf, name_catalan_1m[SeedModChance(4, lengthof(name_catalan_1m), seed)]);
+ strcat(buf, name_catalan_2m[SeedModChance(11, lengthof(name_catalan_2m), seed)]);
+ } else { // feminine form
+ strcat(buf, name_catalan_1f[SeedModChance(4, lengthof(name_catalan_1f), seed)]);
+ strcat(buf, name_catalan_2f[SeedModChance(11, lengthof(name_catalan_2f), seed)]);
+ }
+
+
+ if (SeedModChance(15, 5, seed) == 0) {
+ if (SeedModChance(5, 2, seed) == 0) { // generic suffix
+ strcat(buf, name_catalan_3[SeedModChance(4, lengthof(name_catalan_3), seed)]);
+ } else { // river name suffix
+ strcat(buf, name_catalan_river1[SeedModChance(4, lengthof(name_catalan_river1), seed)]);
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+
+
TownNameGenerator * const _town_name_generators[] =
{
MakeEnglishOriginalTownName,
@@ -714,6 +751,7 @@ TownNameGenerator * const _town_name_generators[] =
MakeDanishTownName,
MakeTurkishTownName,
MakeItalianTownName,
+ MakeCatalanTownName,
};
// DO WE NEED THIS ANY MORE?
diff --git a/openttd.h b/openttd.h
index bf309e27b..4c412cb53 100644
--- a/openttd.h
+++ b/openttd.h
@@ -460,7 +460,8 @@ enum SpecialStrings {
SPECSTR_TOWNNAME_DANISH,
SPECSTR_TOWNNAME_TURKISH,
SPECSTR_TOWNNAME_ITALIAN,
- SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_ITALIAN,
+ SPECSTR_TOWNNAME_CATALAN,
+ SPECSTR_TOWNNAME_LAST = SPECSTR_TOWNNAME_CATALAN,
// special strings for player names on the form "TownName transport".
SPECSTR_PLAYERNAME_START = 0x70EA,
diff --git a/settings.c b/settings.c
index b7a92eed7..083bf54c5 100644
--- a/settings.c
+++ b/settings.c
@@ -1225,7 +1225,7 @@ static const SettingDesc _gameopt_settings[] = {
SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 9,0, 9, STR_NULL, NULL),
SDT_OMANY(GameOptions, currency, SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|custom", STR_NULL, NULL),
SDT_OMANY(GameOptions, units, SLE_UINT8, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL),
- SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 19, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian", STR_NULL, NULL),
+ SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0, 20, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL),
SDT_OMANY(GameOptions, landscape, SLE_UINT8, 0, 0, 0, 3, "normal|hilly|desert|candy", STR_NULL, NULL),
SDT_VAR(GameOptions, snow_line, SLE_UINT8, 0, 0, 1,0,56, STR_NULL, NULL),
SDT_CONDOMANY(GameOptions,autosave, SLE_UINT8, 0, 22, N, 0, 0, 0, "", STR_NULL, NULL),
diff --git a/table/namegen.h b/table/namegen.h
index ca2ff6af2..125cb8c68 100644
--- a/table/namegen.h
+++ b/table/namegen.h
@@ -3131,3 +3131,172 @@ static const char *name_italian_river2[] = {
" Ticino",
" Tevere",
};
+
+static const char *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ès",
+ "La seu d'Urgell",
+ "Pont de Suert",
+ "Igualada",
+ "Manresa",
+ "Solsona",
+ "Les borges blanques",
+ "Tremp",
+ "Sort",
+ "Colera",
+ "Portbou",
+ "El Vendrell",
+ "Falset",
+ "Ripoll",
+ "Cervera",
+ "Gandesa",
+ "Mataró",
+ "Montblanc",
+ "Vilanova i la Geltrú",
+ "Tàrrega",
+ "Camprodon",
+ "Campdevànol",
+ "Cambrils",
+ "Begur",
+ "Set Cases",
+ "Palafrugell",
+ "Begues",
+ "El Bruc",
+ "Cadaqués",
+ "Collbató",
+ "Cervelló",
+ "Esparraguera",
+ "Abrera",
+ "Alp",
+ "Das",
+ "Cercs",
+ "Manlleu",
+ "Masnou",
+ "Molins de rei",
+ "Monistrol",
+ "Rocallaura",
+ "Rubí",
+ "Ripollet",
+ "Sitges",
+ "Roses",
+};
+
+static const char *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í de ",
+ "Santa Coloma de ",
+ "Santa Margarida de ",
+ "Santa Maria de ",
+ "Sant Martí de ",
+ "Sant Pere de ",
+ "Sant Julià de ",
+ "Sant Vicenç de ",
+
+};
+
+static const char *name_catalan_1m[] = {
+ "Torrent",
+ "Cami",
+ "Mont",
+ "Bell",
+ "Puig",
+ "Riu",
+};
+
+static const char *name_catalan_1f[] = {
+ "Aigua",
+ "Selva ",
+ "Vall",
+ "Serra",
+ "Torre",
+ "Riba",
+ "Vall",
+ "Terra",
+};
+
+static const char *name_catalan_2m[] = {
+ "alt",
+ "baix",
+ "fosc",
+ "pelat",
+ "ventós",
+ "negre",
+ "roig",
+ "gris",
+};
+
+static const char *name_catalan_2f[] = {
+ "baixa",
+ "alta",
+ "fosca",
+ "clara",
+ "negra",
+ "roja",
+ "grisa",
+ "freda",
+};
+
+static const char *name_catalan_3[] = {
+ " despí",
+ " desvern",
+ " del camí",
+ " de Mar",
+ " de Dalt",
+ " de Baix",
+ " del Vallès",
+ " de Berguedà",
+ " de Conflent",
+ " de la plana",
+};
+
+static const char *name_catalan_river1[] = {
+ " d'Anoia",
+ " de Ter",
+ " de Llobregat",
+ " d'Ebre",
+ " de Segre",
+ " de Francolí",
+};