translate spell modifiers

This commit is contained in:
Enno Rehling 2012-07-08 15:40:37 -07:00
parent 7b0bdd568d
commit 9812a8dc34
2 changed files with 61 additions and 45 deletions

View File

@ -6982,6 +6982,31 @@
<text locale="en">hungry</text> <text locale="en">hungry</text>
</string> </string>
<string name="smod_far">
<text locale="de">Fernzauber</text>
<text locale="en">far</text>
</string>
<string name="smod_sea">
<text locale="de">Seezauber</text>
<text locale="en">sea</text>
</string>
<string name="smod_ship">
<text locale="de">Schiffszauber</text>
<text locale="en">ship</text>
</string>
<string name="smod_nofamiliar">
<text locale="de">Magier exklusiv</text>
<text locale="en">magicians only</text>
</string>
<string name="smod_none">
<text locale="de">Keine</text>
<text locale="en">none</text>
</string>
<string name="list_and"> <string name="list_and">
<text locale="de"> und </text> <text locale="de"> und </text>
<text locale="en"> and </text> <text locale="en"> and </text>

View File

@ -218,12 +218,26 @@ rparagraph(FILE * F, const char *str, ptrdiff_t indent, int hanging_indent,
} while (*begin); } while (*begin);
} }
static size_t write_spell_modifier(spell * sp, int flag, const char * str, bool cont, char * bufp, size_t size) {
if (sp->sptyp & flag) {
size_t bytes = 0;
if (cont) {
bytes = strlcpy(bufp, ", ", size);
} else {
bytes = strlcpy(bufp, " ", size);
}
bytes += strlcpy(bufp+bytes, str, size-bytes);
return bytes;
}
return 0;
}
static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang) static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
{ {
int bytes, k, itemanz, costtyp; int bytes, k, itemanz, costtyp;
int dh = 0; int dh = 0;
char buf[4096]; char buf[4096];
char *bufp = buf; char *startp, *bufp = buf;
size_t size = sizeof(buf) - 1; size_t size = sizeof(buf) - 1;
spell * sp = sbe->sp; spell * sp = sbe->sp;
const char *params = sp->parameter; const char *params = sp->parameter;
@ -297,52 +311,29 @@ static void nr_spell(FILE * F, spellbook_entry * sbe, const struct locale *lang)
bytes = (int)strlcpy(buf, LOC(lang, "nr_spell_modifiers"), size); bytes = (int)strlcpy(buf, LOC(lang, "nr_spell_modifiers"), size);
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
if (sp->sptyp & FARCASTING) {
bytes = (int)strlcpy(bufp, " Fernzauber", size); startp = bufp;
if (wrptr(&bufp, &size, bytes) != 0) bytes = (int)write_spell_modifier(sp, FARCASTING, LOC(lang, "smod_far"), startp!=bufp, bufp, size);
WARN_STATIC_BUFFER(); if (bytes && wrptr(&bufp, &size, bytes) != 0) {
dh = 1; WARN_STATIC_BUFFER();
} }
if (sp->sptyp & OCEANCASTABLE) { bytes = (int)write_spell_modifier(sp, OCEANCASTABLE, LOC(lang, "smod_sea"), startp!=bufp, bufp, size);
if (dh == 1) { if (bytes && wrptr(&bufp, &size, bytes) != 0) {
bytes = (int)strlcpy(bufp, ",", size); WARN_STATIC_BUFFER();
if (wrptr(&bufp, &size, bytes) != 0) }
WARN_STATIC_BUFFER(); bytes = (int)write_spell_modifier(sp, ONSHIPCAST, LOC(lang, "smod_ship"), startp!=bufp, bufp, size);
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
WARN_STATIC_BUFFER();
}
bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_nofamiliar"), startp!=bufp, bufp, size);
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
WARN_STATIC_BUFFER();
}
if (startp==bufp) {
bytes = (int)write_spell_modifier(sp, NOTFAMILIARCAST, LOC(lang, "smod_none"), startp!=bufp, bufp, size);
if (bytes && wrptr(&bufp, &size, bytes) != 0) {
WARN_STATIC_BUFFER();
} }
bytes = (int)strlcpy(bufp, " Seezauber", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
dh = 1;
}
if (sp->sptyp & ONSHIPCAST) {
if (dh == 1) {
bytes = (int)strlcpy(bufp, ",", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
}
bytes = (int)strlcpy(bufp, " Schiffszauber", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
dh = 1;
}
if (sp->sptyp & NOTFAMILIARCAST) {
if (dh == 1) {
bytes = (int)strlcpy(bufp, ", k", size);
} else {
bytes = (int)strlcpy(bufp, " K", size);
}
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
bytes =
(int)strlcpy(bufp, "ann nicht vom Vertrauten gezaubert werden", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
dh = 1;
}
if (dh == 0) {
bytes = (int)strlcpy(bufp, " Keine", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
} }
*bufp = 0; *bufp = 0;
rparagraph(F, buf, 0, 0, 0); rparagraph(F, buf, 0, 0, 0);