Started converting the naming-functions (iso-8859-1 constants must be removed from code). it's stupid monkey labour.

This commit is contained in:
Enno Rehling 2007-06-27 23:32:24 +00:00
parent 57ae5f8fcd
commit 1637950201
4 changed files with 201 additions and 121 deletions

View file

@ -1321,44 +1321,6 @@ prefix_cmd(unit * u, struct order * ord)
return 0; return 0;
} }
static struct local_names * synonyms;
static void
init_synonyms(void)
{
int i;
for (i=0;localenames[i];++i) {
const struct locale * lang = find_locale(localenames[i]);
boolean exist = false;
struct local_names * in = synonyms;
while (in!=NULL) {
if (in->lang==lang) {
exist = true;
break;
}
in = in->next;
}
if (in==NULL) in = calloc(sizeof(local_names), 1);
in->next = synonyms;
in->lang = lang;
if (!exist) {
int key;
for (key=0;race_prefixes[key];++key) {
variant var;
const xmlChar * pname = locale_string(lang, race_prefixes[key]);
if (findtoken(&in->names, pname, &var)==E_TOK_NOMATCH || var.i!=key) {
var.i = key;
addtoken(&in->names, pname, var);
addtoken(&in->names, locale_string(lang, race_prefixes[key]), var);
}
}
}
synonyms = in;
}
}
static int static int
display_cmd(unit * u, struct order * ord) display_cmd(unit * u, struct order * ord)
{ {

View file

@ -45,73 +45,6 @@
/* Untote */ /* Untote */
#define UNTOT_VOR 23
static const xmlChar *untot_vor[UNTOT_VOR] =
{
"Grausige ",
"Stöhnende ",
"Schlurfende ",
"Schwarzgewandete ",
"Faulende ",
"Angsteinflößende ",
"Heulende ",
"Wartende ",
"Grauenvolle ",
"Schwarze ",
"Dunkle ",
"Fürchterliche ",
"Grauenhafte ",
"Furchtbare ",
"Entsetzliche ",
"Schauderhafte ",
"Schreckliche ",
"Gespenstische ",
"Ekelhafte ",
"Düstere ",
"Schaurige ",
"Erbarmungslose ",
"Hungrige "
};
#define UNTOT 13
static const xmlChar *untot[UNTOT] =
{
"Geister",
"Phantome",
"Vampire",
"Zombies",
"Gespenster",
"Kreaturen",
"Gestalten",
"Schemen",
"Monster",
"Krieger",
"Ghule",
"Kopflose",
"Irrlichter"
};
#define UNTOT_NACH 14
static const xmlChar *untot_nach[UNTOT_NACH] =
{
" der Nacht",
" der Schatten",
" der Finsternis",
" des Bösen",
" der Erschlagenen",
" der Verfluchten",
" der Gefolterten",
" der Ruhelosen",
" aus dem Nebel",
" aus dem Dunkel",
" der Tiefe",
" in Ketten",
" aus dem Totenreich",
" aus der Unterwelt"
};
const xmlChar * const xmlChar *
describe_braineater(unit * u, const struct locale * lang) describe_braineater(unit * u, const struct locale * lang)
@ -119,31 +52,59 @@ describe_braineater(unit * u, const struct locale * lang)
return LOC(lang, "describe_braineater"); return LOC(lang, "describe_braineater");
} }
const char * const xmlChar *
undead_name(const unit * u) undead_name(const unit * u)
{ {
static int num_postfix, num_name, num_prefix;
int uv, uu, un; int uv, uu, un;
static char name[NAMESIZE + 1]; static xmlChar name[NAMESIZE + 1];
char zText[32];
const xmlChar * str;
if (num_prefix==0) {
for (num_prefix=0;;++num_prefix) {
sprintf(zText, "undead_prefix_%d", num_prefix);
str = locale_getstring(default_locale, zText);
if (str==NULL) break;
}
for (num_name=0;;++num_name) {
sprintf(zText, "undead_name_%d", num_name);
str = locale_getstring(default_locale, zText);
if (str==NULL) break;
}
for (num_postfix=0;;++num_postfix) {
sprintf(zText, "undead_postfix_%d", num_postfix);
str = locale_getstring(default_locale, zText);
if (str==NULL) break;
}
}
/* nur 50% aller Namen haben "Vor-Teil" */ /* nur 50% aller Namen haben "Vor-Teil" */
u=u; u=u;
uv = rng_int() % (UNTOT_VOR * 2); uv = rng_int() % (num_prefix * 2);
uu = rng_int() % UNTOT; uu = rng_int() % num_name;
un = rng_int() % (UNTOT_NACH * (uv >= UNTOT_VOR ? 1 : 2)); un = rng_int() % (num_postfix * (uv >= num_prefix ? 1 : 2));
/* nur 50% aller Namen haben "Nach-Teil", wenn kein Vor-Teil */ /* nur 50% aller Namen haben "Nach-Teil", wenn kein Vor-Teil */
if (uv < UNTOT_VOR) { name[0] = 0;
strcpy(name, untot_vor[uv]); if (uv < num_prefix) {
} else { sprintf(zText, "undead_prefix_%d", uv);
name[0] = 0; str = locale_getstring(default_locale, zText);
if (str) xstrcat(name, str);
} }
strcat(name, untot[uu]); sprintf(zText, "undead_name_%d", uu);
str = locale_getstring(default_locale, zText);
if (un < UNTOT_NACH) if (str) xstrcat(name, str);
strcat(name, untot_nach[un]);
if (un < num_postfix) {
sprintf(zText, "undead_postfix_%d", un);
str = locale_getstring(default_locale, zText);
if (str) xstrcat(name, str);
}
return name; return name;
} }
@ -583,7 +544,7 @@ dragon_name(const unit *u)
/* Dracoide */ /* Dracoide */
#define DRAC_PRE 13 #define DRAC_PRE 13
static const xmlChar *drac_pre[DRAC_PRE] = { static const char *drac_pre[DRAC_PRE] = {
"Siss", "Siss",
"Xxaa", "Xxaa",
"Shht", "Shht",
@ -600,7 +561,7 @@ static const xmlChar *drac_pre[DRAC_PRE] = {
}; };
#define DRAC_MID 12 #define DRAC_MID 12
static const xmlChar *drac_mid[DRAC_MID] = { static const char *drac_mid[DRAC_MID] = {
"siss", "siss",
"xxaa", "xxaa",
"shht", "shht",
@ -616,7 +577,7 @@ static const xmlChar *drac_mid[DRAC_MID] = {
}; };
#define DRAC_SUF 10 #define DRAC_SUF 10
static const xmlChar *drac_suf[DRAC_SUF] = { static const char *drac_suf[DRAC_SUF] = {
"xil", "xil",
"shh", "shh",
"s", "s",

View file

@ -17,6 +17,7 @@
<xi:include href="spells.xml"/> <xi:include href="spells.xml"/>
<xi:include href="terrains.xml"/> <xi:include href="terrains.xml"/>
<xi:include href="dungeons.xml"/> <xi:include href="dungeons.xml"/>
<xi:include href="names-undead.xml"/>
<game name="Eressea" units="1000"> <game name="Eressea" units="1000">
<!-- Game specific settings --> <!-- Game specific settings -->

156
src/res/names-undead.xml Normal file
View file

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<strings>
<string name="undead_prefix_0">
<text locale="de">Grausige</text>
</string>
<string name="undead_prefix_1">
<text locale="de">Stöhnende</text>
</string>
<string name="undead_prefix_2">
<text locale="de">Schlurfende</text>
</string>
<string name="undead_prefix_3">
<text locale="de">Schwarzgewandete</text>
</string>
<string name="undead_prefix_4">
<text locale="de">Faulende</text>
</string>
<string name="undead_prefix_5">
<text locale="de">Angsteinflößende</text>
</string>
<string name="undead_prefix_6">
<text locale="de">Heulende</text>
</string>
<string name="undead_prefix_7">
<text locale="de">Wartende</text>
</string>
<string name="undead_prefix_8">
<text locale="de">Grauenvolle</text>
</string>
<string name="undead_prefix_9">
<text locale="de">Schwarze</text>
</string>
<string name="undead_prefix_10">
<text locale="de">Dunkle</text>
</string>
<string name="undead_prefix_11">
<text locale="de">Fürchterliche</text>
</string>
<string name="undead_prefix_12">
<text locale="de">Grauenhafte</text>
</string>
<string name="undead_prefix_13">
<text locale="de">Furchtbare</text>
</string>
<string name="undead_prefix_14">
<text locale="de">Entsetzliche</text>
</string>
<string name="undead_prefix_15">
<text locale="de">Schauderhafte</text>
</string>
<string name="undead_prefix_16">
<text locale="de">Schreckliche</text>
</string>
<string name="undead_prefix_17">
<text locale="de">Gespenstische</text>
</string>
<string name="undead_prefix_18">
<text locale="de">Ekelhafte</text>
</string>
<string name="undead_prefix_19">
<text locale="de">Düstere</text>
</string>
<string name="undead_prefix_20">
<text locale="de">Schaurige</text>
</string>
<string name="undead_prefix_21">
<text locale="de">Erbarmungslose</text>
</string>
<string name="undead_prefix_22">
<text locale="de">Hungrige</text>
</string>
<string name="undead_name_0">
<text locale="de">Geister</text>
</string>
<string name="undead_name_1">
<text locale="de">Phantome</text>
</string>
<string name="undead_name_2">
<text locale="de">Vampire</text>
</string>
<string name="undead_name_3">
<text locale="de">Zombies</text>
</string>
<string name="undead_name_4">
<text locale="de">Gespenster</text>
</string>
<string name="undead_name_5">
<text locale="de">Kreaturen</text>
</string>
<string name="undead_name_6">
<text locale="de">Gestalten</text>
</string>
<string name="undead_name_7">
<text locale="de">Schemen</text>
</string>
<string name="undead_name_8">
<text locale="de">Monster</text>
</string>
<string name="undead_name_9">
<text locale="de">Krieger</text>
</string>
<string name="undead_name_10">
<text locale="de">Ghule</text>
</string>
<string name="undead_name_11">
<text locale="de">Kopflose</text>
</string>
<string name="undead_name_12">
<text locale="de">Irrlichter</text>
</string>
<string name="undead_postfix_0">
<text locale="de">der Nacht</text>
</string>
<string name="undead_postfix_1">
<text locale="de">der Schatten</text>
</string>
<string name="undead_postfix_2">
<text locale="de">der Finsternis</text>
</string>
<string name="undead_postfix_3">
<text locale="de">des Bösen</text>
</string>
<string name="undead_postfix_4">
<text locale="de">der Erschlagenen</text>
</string>
<string name="undead_postfix_5">
<text locale="de">der Verfluchten</text>
</string>
<string name="undead_postfix_6">
<text locale="de">der Gefolterten</text>
</string>
<string name="undead_postfix_7">
<text locale="de">der Ruhelosen</text>
</string>
<string name="undead_postfix_8">
<text locale="de">aus dem Nebel</text>
</string>
<string name="undead_postfix_9">
<text locale="de">aus dem Dunkel</text>
</string>
<string name="undead_postfix_10">
<text locale="de">der Tiefe</text>
</string>
<string name="undead_postfix_11">
<text locale="de">in Ketten</text>
</string>
<string name="undead_postfix_12">
<text locale="de">aus dem Totenreich</text>
</string>
<string name="undead_postfix_13">
<text locale="de">aus der Unterwelt</text>
</string>
</strings>