XML-configurable, Unicode-enabled naming of dragons.

This commit is contained in:
Enno Rehling 2007-06-28 00:29:42 +00:00
parent eea094a010
commit 219e836791
6 changed files with 482 additions and 63 deletions

View file

@ -216,54 +216,6 @@ const char *silbe3[SIL3] = {
"bus", "bus",
}; };
#define DTITEL 5
const xmlChar *dtitel[6][DTITEL] =
{
{ /* Ebene, Hochland */
"der Weise",
"der Allwissende",
"der Mächtige",
"die Ehrwürdige",
"die Listige"
},
{ /* Wald */
"der Grüne",
"die Strafende",
"der Sehende",
"der Reisende",
"die Wissende"
},
{ /* Berge */
"der Goldene",
"der Graue",
"der Steinerne",
"die Alte",
"die Mächtige"
},
{ /* Wüste */
"die Goldene",
"der Grausame",
"der Sanddrache",
"der Durstige",
"die Verzehrende"
},
{ /* Sumpf */
"die Grüne",
"die Rote",
"der Furchtlose",
"der Allmächtige",
"der Weitblickende"
},
{ /* Gletscher */
"der Weiße",
"die Glänzende",
"der Wissende",
"die Unbarmherzige",
"die Schöne"
}
};
const xmlChar * const xmlChar *
generic_name(const unit *u) generic_name(const unit *u)
{ {
@ -277,34 +229,59 @@ const xmlChar *
dragon_name(const unit *u) dragon_name(const unit *u)
{ {
static char name[NAMESIZE + 1]; static char name[NAMESIZE + 1];
int rnd = rng_int() % DTITEL; int rnd, ter = 0;
const xmlChar *t = dtitel[0][rnd];
int anzahl = 1; int anzahl = 1;
static int num_postfix;
char zText[32];
const xmlChar * str;
if (num_postfix==0) {
for (num_postfix=0;;++num_postfix) {
sprintf(zText, "dragon_postfix_%d", num_postfix);
str = locale_getstring(default_locale, zText);
if (str==NULL) break;
}
if (num_postfix==0) num_postfix = -1;
}
if (num_postfix<=0) {
return NULL;
}
if (u) { if (u) {
region *r = u->region; region *r = u->region;
anzahl = u->number; anzahl = u->number;
switch (rterrain(r)) { switch (rterrain(r)) {
case T_PLAIN: case T_PLAIN:
t = dtitel[1][rnd]; ter = 1;
break; break;
case T_MOUNTAIN: case T_MOUNTAIN:
t = dtitel[2][rnd]; ter = 2;
break; break;
case T_DESERT: case T_DESERT:
t = dtitel[3][rnd]; ter = 3;
break; break;
case T_SWAMP: case T_SWAMP:
t = dtitel[4][rnd]; ter = 4;
break; break;
case T_GLACIER: case T_GLACIER:
t = dtitel[5][rnd]; ter = 5;
break; break;
} }
} }
if (anzahl > 1) { rnd = num_postfix / 6;
sprintf(name, "Die %sn von %s", t+4, rname(u->region, NULL)); rnd = (rng_int() % rnd) + ter * rnd;
sprintf(zText, "dragon_postfix_%d", rnd);
str = locale_getstring(default_locale, zText);
assert(str!=NULL);
if (anzahl > 1) {
const char * no_article = strchr((const char *)str, ' ');
assert(no_article);
/* TODO: GERMAN */
sprintf(name, "Die %sn von %s", no_article, rname(u->region, NULL));
} else { } else {
char n[32]; char n[32];
@ -312,20 +289,20 @@ dragon_name(const unit *u)
strcat(n, silbe2[rng_int() % SIL2]); strcat(n, silbe2[rng_int() % SIL2]);
strcat(n, silbe3[rng_int() % SIL3]); strcat(n, silbe3[rng_int() % SIL3]);
if (rng_int() % 5 > 2) { if (rng_int() % 5 > 2) {
sprintf(name, "%s, %s", n, t); /* "Name, der Titel" */ sprintf(name, "%s, %s", n, str); /* "Name, der Titel" */
} else { } else {
strcpy(name, t); /* "Der Titel Name" */ strcpy(name, (const char *)str); /* "Der Titel Name" */
name[0] = (char) toupper(name[0]); name[0] = (char)toupper(name[0]);
strcat(name, " "); strcat(name, " ");
strcat(name, n); strcat(name, n);
} }
if (u && (rng_int() % 3 == 0)) { if (u && (rng_int() % 3 == 0)) {
strcat(name, " von "); strcat(name, " von ");
strcat(name, rname(u->region, NULL)); strcat(name, (const char *)rname(u->region, NULL));
} }
} }
return name; return (xmlChar *)name;
} }
/* Dracoide */ /* Dracoide */
@ -406,6 +383,8 @@ abkz(const xmlChar *s, size_t max)
unsigned int c = 0; unsigned int c = 0;
size_t bpt, i; size_t bpt, i;
/* TODO: UNICODE. This function uses isalnum */
max = min(max, 79); max = min(max, 79);
/* Prüfen, ob Kurz genug */ /* Prüfen, ob Kurz genug */
@ -460,7 +439,7 @@ abkz(const xmlChar *s, size_t max)
buf[c] = 0; buf[c] = 0;
return buf; return (const xmlChar *)buf;
} }
void void

View file

@ -22,6 +22,7 @@
<xi:include href="names-skeletons.xml"/> <xi:include href="names-skeletons.xml"/>
<xi:include href="names-zombies.xml"/> <xi:include href="names-zombies.xml"/>
<xi:include href="names-ghouls.xml"/> <xi:include href="names-ghouls.xml"/>
<xi:include href="names-dragons.xml"/>
<game name="Eressea" units="1000"> <game name="Eressea" units="1000">
<!-- Game specific settings --> <!-- Game specific settings -->

95
src/res/names-dragons.xml Normal file
View file

@ -0,0 +1,95 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<strings>
<string name="dragon_postfix_0">
<text locale="de">der Weise</text>
</string>
<string name="dragon_postfix_1">
<text locale="de">der Allwissende</text>
</string>
<string name="dragon_postfix_2">
<text locale="de">der Mächtige</text>
</string>
<string name="dragon_postfix_3">
<text locale="de">die Ehrwürdige</text>
</string>
<string name="dragon_postfix_4">
<text locale="de">die Listige</text>
</string>
<string name="dragon_postfix_5">
<text locale="de">der Grüne</text>
</string>
<string name="dragon_postfix_6">
<text locale="de">die Strafende</text>
</string>
<string name="dragon_postfix_7">
<text locale="de">der Sehende</text>
</string>
<string name="dragon_postfix_8">
<text locale="de">der Reisende</text>
</string>
<string name="dragon_postfix_9">
<text locale="de">die Wissende</text>
</string>
<string name="dragon_postfix_10">
<text locale="de">der Goldene</text>
</string>
<string name="dragon_postfix_11">
<text locale="de">der Graue</text>
</string>
<string name="dragon_postfix_12">
<text locale="de">der Steinerne</text>
</string>
<string name="dragon_postfix_13">
<text locale="de">die Alte</text>
</string>
<string name="dragon_postfix_14">
<text locale="de">die Mächtige</text>
</string>
<string name="dragon_postfix_15">
<text locale="de">die Goldene</text>
</string>
<string name="dragon_postfix_16">
<text locale="de">der Grausame</text>
</string>
<string name="dragon_postfix_17">
<text locale="de">der Sanddrache</text>
</string>
<string name="dragon_postfix_18">
<text locale="de">der Durstige</text>
</string>
<string name="dragon_postfix_19">
<text locale="de">die Verzehrende</text>
</string>
<string name="dragon_postfix_20">
<text locale="de">die Grüne</text>
</string>
<string name="dragon_postfix_21">
<text locale="de">die Rote</text>
</string>
<string name="dragon_postfix_22">
<text locale="de">der Furchtlose</text>
</string>
<string name="dragon_postfix_23">
<text locale="de">der Allmächtige</text>
</string>
<string name="dragon_postfix_24">
<text locale="de">der Weitblickende</text>
</string>
<string name="dragon_postfix_25">
<text locale="de">der Weiße</text>
</string>
<string name="dragon_postfix_26">
<text locale="de">die Glänzende</text>
</string>
<string name="dragon_postfix_27">
<text locale="de">der Wissende</text>
</string>
<string name="dragon_postfix_28">
<text locale="de">die Unbarmherzige</text>
</string>
<string name="dragon_postfix_29">
<text locale="de">die Schöne</text>
</string>
</strings>

115
src/res/names-ghouls.xml Normal file
View file

@ -0,0 +1,115 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<strings>
<string name="ghoul_prefix_0">
<text locale="de">Faulende</text>
</string>
<string name="ghoul_prefix_1">
<text locale="de">Angsteinflößende</text>
</string>
<string name="ghoul_prefix_2">
<text locale="de">Leise</text>
</string>
<string name="ghoul_prefix_3">
<text locale="de">Kinderfressende</text>
</string>
<string name="ghoul_prefix_4">
<text locale="de">Menschenfressende</text>
</string>
<string name="ghoul_prefix_5">
<text locale="de">Wahnsinnige</text>
</string>
<string name="ghoul_prefix_6">
<text locale="de">Brutale</text>
</string>
<string name="ghoul_prefix_7">
<text locale="de">Schwarze</text>
</string>
<string name="ghoul_prefix_8">
<text locale="de">Dunkle</text>
</string>
<string name="ghoul_prefix_9">
<text locale="de">Fürchterliche</text>
</string>
<string name="ghoul_prefix_10">
<text locale="de">Grauenhafte</text>
</string>
<string name="ghoul_prefix_11">
<text locale="de">Furchtbare</text>
</string>
<string name="ghoul_prefix_12">
<text locale="de">Entsetzliche</text>
</string>
<string name="ghoul_prefix_13">
<text locale="de">Schauderhafte</text>
</string>
<string name="ghoul_prefix_14">
<text locale="de">Schreckliche</text>
</string>
<string name="ghoul_prefix_15">
<text locale="de">Düstere</text>
</string>
<string name="ghoul_prefix_16">
<text locale="de">Schaurige</text>
</string>
<string name="ghoul_name_0">
<text locale="de">Ghoule</text>
</string>
<string name="ghoul_name_1">
<text locale="de">Kreaturen</text>
</string>
<string name="ghoul_name_2">
<text locale="de">Verlorene</text>
</string>
<string name="ghoul_name_3">
<text locale="de">Erschlagene</text>
</string>
<string name="ghoul_name_4">
<text locale="de">Verdammte</text>
</string>
<string name="ghoul_name_5">
<text locale="de">Schlurfende Ghoule</text>
</string>
<string name="ghoul_postfix_0">
<text locale="de">der Nacht</text>
</string>
<string name="ghoul_postfix_1">
<text locale="de">der Schatten</text>
</string>
<string name="ghoul_postfix_2">
<text locale="de">der Finsternis</text>
</string>
<string name="ghoul_postfix_3">
<text locale="de">des Bösen</text>
</string>
<string name="ghoul_postfix_4">
<text locale="de">der Erschlagenen</text>
</string>
<string name="ghoul_postfix_5">
<text locale="de">der Verfluchten</text>
</string>
<string name="ghoul_postfix_6">
<text locale="de">der Ruhelosen</text>
</string>
<string name="ghoul_postfix_7">
<text locale="de">aus dem Nebel</text>
</string>
<string name="ghoul_postfix_8">
<text locale="de">aus dem Dunkel</text>
</string>
<string name="ghoul_postfix_9">
<text locale="de">der Tiefe</text>
</string>
<string name="ghoul_postfix_10">
<text locale="de">in Ketten</text>
</string>
<string name="ghoul_postfix_11">
<text locale="de">aus dem Totenreich</text>
</string>
<string name="ghoul_postfix_12">
<text locale="de">aus der Unterwelt</text>
</string>
</strings>

121
src/res/names-skeletons.xml Normal file
View file

@ -0,0 +1,121 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<strings>
<string name="skeleton_prefix_0">
<text locale="de">Klapperige</text>
</string>
<string name="skeleton_prefix_1">
<text locale="de">Stöhnende</text>
</string>
<string name="skeleton_prefix_2">
<text locale="de">Schwarzknochige</text>
</string>
<string name="skeleton_prefix_3">
<text locale="de">Schwarzgewandete</text>
</string>
<string name="skeleton_prefix_4">
<text locale="de">Angsteinflößende</text>
</string>
<string name="skeleton_prefix_5">
<text locale="de">Heulende</text>
</string>
<string name="skeleton_prefix_6">
<text locale="de">Wartende</text>
</string>
<string name="skeleton_prefix_7">
<text locale="de">Grauenvolle</text>
</string>
<string name="skeleton_prefix_8">
<text locale="de">Schwarze</text>
</string>
<string name="skeleton_prefix_9">
<text locale="de">Dunkle</text>
</string>
<string name="skeleton_prefix_10">
<text locale="de">Fürchterliche</text>
</string>
<string name="skeleton_prefix_11">
<text locale="de">Grauenhafte</text>
</string>
<string name="skeleton_prefix_12">
<text locale="de">Furchtbare</text>
</string>
<string name="skeleton_prefix_13">
<text locale="de">Entsetzliche</text>
</string>
<string name="skeleton_prefix_14">
<text locale="de">Schauderhafte</text>
</string>
<string name="skeleton_prefix_15">
<text locale="de">Schreckliche</text>
</string>
<string name="skeleton_prefix_16">
<text locale="de">Düstere</text>
</string>
<string name="skeleton_prefix_17">
<text locale="de">Schaurige</text>
</string>
<string name="skeleton_prefix_18">
<text locale="de">Erbarmungslose</text>
</string>
<string name="skeleton_name_0">
<text locale="de">Skelette</text>
</string>
<string name="skeleton_name_1">
<text locale="de">Kreaturen</text>
</string>
<string name="skeleton_name_2">
<text locale="de">Krieger</text>
</string>
<string name="skeleton_name_3">
<text locale="de">Kämpfer</text>
</string>
<string name="skeleton_name_4">
<text locale="de">Rächer</text>
</string>
<string name="skeleton_postfix_0">
<text locale="de">der Nacht</text>
</string>
<string name="skeleton_postfix_1">
<text locale="de">der Schatten</text>
</string>
<string name="skeleton_postfix_2">
<text locale="de">der Finsternis</text>
</string>
<string name="skeleton_postfix_3">
<text locale="de">des Bösen</text>
</string>
<string name="skeleton_postfix_4">
<text locale="de">der Erschlagenen</text>
</string>
<string name="skeleton_postfix_5">
<text locale="de">der Verfluchten</text>
</string>
<string name="skeleton_postfix_6">
<text locale="de">der Gefolterten</text>
</string>
<string name="skeleton_postfix_7">
<text locale="de">der Ruhelosen</text>
</string>
<string name="skeleton_postfix_8">
<text locale="de">aus dem Nebel</text>
</string>
<string name="skeleton_postfix_9">
<text locale="de">aus dem Dunkel</text>
</string>
<string name="skeleton_postfix_10">
<text locale="de">der Tiefe</text>
</string>
<string name="skeleton_postfix_11">
<text locale="de">in Ketten</text>
</string>
<string name="skeleton_postfix_12">
<text locale="de">aus dem Totenreich</text>
</string>
<string name="skeleton_postfix_13">
<text locale="de">aus der Unterwelt</text>
</string>
</strings>

108
src/res/names-zombies.xml Normal file
View file

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<strings>
<string name="zombie_prefix_0">
<text locale="de">Faulende</text>
</string>
<string name="zombie_prefix_1">
<text locale="de">Zerschlagene</text>
</string>
<string name="zombie_prefix_2">
<text locale="de">Gefolterte</text>
</string>
<string name="zombie_prefix_3">
<text locale="de">Angsteinflößende</text>
</string>
<string name="zombie_prefix_4">
<text locale="de">Leise Schlurfende</text>
</string>
<string name="zombie_prefix_5">
<text locale="de">Kinderfressende</text>
</string>
<string name="zombie_prefix_6">
<text locale="de">Schwarze</text>
</string>
<string name="zombie_prefix_7">
<text locale="de">Dunkle</text>
</string>
<string name="zombie_prefix_8">
<text locale="de">Fürchterliche</text>
</string>
<string name="zombie_prefix_9">
<text locale="de">Grauenhafte</text>
</string>
<string name="zombie_prefix_10">
<text locale="de">Furchtbare</text>
</string>
<string name="zombie_prefix_11">
<text locale="de">Entsetzliche</text>
</string>
<string name="zombie_prefix_12">
<text locale="de">Schauderhafte</text>
</string>
<string name="zombie_prefix_13">
<text locale="de">Schreckliche</text>
</string>
<string name="zombie_prefix_14">
<text locale="de">Düstere</text>
</string>
<string name="zombie_prefix_15">
<text locale="de">Schaurige</text>
</string>
<string name="zombie_name_0">
<text locale="de">Zombies</text>
</string>
<string name="zombie_name_1">
<text locale="de">Kreaturen</text>
</string>
<string name="zombie_name_2">
<text locale="de">Verlorene</text>
</string>
<string name="zombie_name_3">
<text locale="de">Erschlagene</text>
</string>
<string name="zombie_name_4">
<text locale="de">Verdammte</text>
</string>
<string name="zombie_postfix_0">
<text locale="de">der Nacht</text>
</string>
<string name="zombie_postfix_1">
<text locale="de">der Schatten</text>
</string>
<string name="zombie_postfix_2">
<text locale="de">der Finsternis</text>
</string>
<string name="zombie_postfix_3">
<text locale="de">des Bösen</text>
</string>
<string name="zombie_postfix_4">
<text locale="de">der Erschlagenen</text>
</string>
<string name="zombie_postfix_5">
<text locale="de">der Verfluchten</text>
</string>
<string name="zombie_postfix_6">
<text locale="de">der Ruhelosen</text>
</string>
<string name="zombie_postfix_7">
<text locale="de">aus dem Nebel</text>
</string>
<string name="zombie_postfix_8">
<text locale="de">aus dem Dunkel</text>
</string>
<string name="zombie_postfix_9">
<text locale="de">der Tiefe</text>
</string>
<string name="zombie_postfix_10">
<text locale="de">in Ketten</text>
</string>
<string name="zombie_postfix_11">
<text locale="de">aus dem Totenreich</text>
</string>
<string name="zombie_postfix_12">
<text locale="de">aus der Unterwelt</text>
</string>
</strings>