From 7e36df93a4ac9e8e2b3db1b5f152c4ccb6c0bd25 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 19 Jul 2007 07:25:28 +0000 Subject: [PATCH] Unicode WIP: - completed i18n for spells.c - started on i18n for combatspells --- src/common/kernel/battle.c | 8 ---- src/common/kernel/battle.h | 1 - src/common/spells/combatspells.c | 31 ++++--------- src/common/spells/spells.c | 50 ++++++++++---------- src/res/messages.xml | 79 ++++++++++++++++++++++++++++++-- 5 files changed, 109 insertions(+), 60 deletions(-) diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 18595bde2..8a877ad6c 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -239,14 +239,6 @@ message_all(battle * b, message * m) } } -void -battlerecord(battle * b, const char *s) -{ - struct message * m = msg_message("battle_msg", "string", s); - message_all(b, m); - msg_release(m); -} - static void fbattlerecord(battle * b, faction * f, const char *s) { diff --git a/src/common/kernel/battle.h b/src/common/kernel/battle.h index 1dfa2b6dd..8548741eb 100644 --- a/src/common/kernel/battle.h +++ b/src/common/kernel/battle.h @@ -238,7 +238,6 @@ extern "C" { extern troop select_enemy(struct fighter * af, int minrow, int maxrow, int select); extern int count_enemies(struct battle * b, const struct fighter * af, int minrow, int maxrow, int select); extern boolean terminate(troop dt, troop at, int type, const char *damage, boolean missile); - extern void battlerecord(battle * b, const char *s); extern void message_all(battle * b, struct message * m); extern void message_faction(battle * b, struct faction * f, struct message * m); extern int hits(troop at, troop dt, weapon * awp); diff --git a/src/common/spells/combatspells.c b/src/common/spells/combatspells.c index 5dede6c77..4be799710 100644 --- a/src/common/spells/combatspells.c +++ b/src/common/spells/combatspells.c @@ -525,21 +525,7 @@ sp_mindblast(fighter * fi, int level, double power, spell * sp) --force; } - sprintf(buf, "%d Krieger %s Erinnerungen", k, k == 1 ? "verliert" : "verlieren"); - - if (killed > 0) { - scat(", "); - icat(killed); - scat(" Krieger "); - if (killed == 1) { - scat("wurde"); - } else { - scat("wurden"); - } - scat(" getötet"); - } - - m = msg_message("cast_spell_effect", "mage spell effect", mage, sp, buf); + m = msg_message("sp_midblast_effect", "mage spell amount dead", mage, sp, k, killed); message_all(b, m); msg_release(m); return level; @@ -699,6 +685,7 @@ sp_shadowcall(fighter * fi, int level, double power, spell * sp) unit *u; const char * races[3] = { "shadowbat", "nightmare", "vampunicorn" }; const race *rc = rc_find(races[rng_int()%3]); + message * msg; unused(sp); @@ -715,9 +702,9 @@ sp_shadowcall(fighter * fi, int level, double power, spell * sp) a_add(&u->attribs, a); make_fighter(b, u, fi->side, is_attacker(fi)); - sprintf(buf, "%s ruft %d %s zu Hilfe", unitname(mage), force, - racename(default_locale, u, u->race)); - battlerecord(b, buf); + msg = msg_message("sp_shadowcall_effect", "mage amount race", mage, u->number, u->race); + message_all(b, msg); + msg_release(msg); return level; } @@ -1308,7 +1295,7 @@ sp_armorshield(fighter * fi, int level, double power, spell * sp) int effect; int duration; battle *b = fi->side->battle; - message * m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, ""); + message * m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); @@ -1335,7 +1322,7 @@ sp_reduceshield(fighter * fi, int level, double power, spell * sp) int effect; int duration; battle *b = fi->side->battle; - message * m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, ""); + message * m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); @@ -1362,7 +1349,7 @@ sp_fumbleshield(fighter * fi, int level, double power, spell * sp) int effect; int duration; battle *b = fi->side->battle; - message * m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, ""); + message * m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); @@ -1464,7 +1451,7 @@ int sp_keeploot(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - message * m = msg_message("cast_spell_effect", "mage spell effect", fi->unit, sp, ""); + message * m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); msg_release(m); diff --git a/src/common/spells/spells.c b/src/common/spells/spells.c index 26c02691d..8afa1098c 100644 --- a/src/common/spells/spells.c +++ b/src/common/spells/spells.c @@ -5506,7 +5506,7 @@ sp_pullastral(castorder *co) rl2 = rl2->next; } if (!rl2) { - ADDMSG(&u->faction->msgs, msg_feedback(u, co->order, "spellfail::nocontact", + ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "spellfail::nocontact", "target", rt)); free_regionlist(rl); return 0; @@ -6079,6 +6079,7 @@ sp_eternizewall(castorder *co) int cast_level = co->level; double power = co->force; spellparameter *pa = co->par; + message * msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ if (pa->param[0]->flag == TARGET_NOTFOUND) return 0; @@ -6094,17 +6095,21 @@ sp_eternizewall(castorder *co) /* melden, 1x pro Partei in der Burg */ for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT); + msg = msg_message("sp_eternizewall_effect", "mage building region", mage, b, r); for (u = r->units; u; u = u->next) { if (!fval(u->faction, FFL_SELECT)) { fset(u->faction, FFL_SELECT); if (u->building == b) { - sprintf(buf, "Mit einem Ritual bindet %s die magischen Kräfte " - "der Erde in die Mauern von %s", unitname(mage), - buildingname(b)); - addmessage(r, u->faction, buf, MSG_EVENT, ML_INFO); + r_addmessage(r, u->faction, msg); } } } + if (r!=mage->region) { + add_message(&mage->faction->msgs, msg); + } else if (mage->building!=b) { + r_addmessage(r, mage->faction, msg); + } + msg_release(msg); return cast_level; } @@ -6133,11 +6138,11 @@ sp_permtransfer(castorder *co) { int aura; unit *tu; - region *r = co->rt; unit *mage = co->magician.u; int cast_level = co->level; spellparameter *pa = co->par; const spell *sp = co->sp; + message * msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ if (pa->param[0]->flag == TARGET_NOTFOUND) return 0; @@ -6167,8 +6172,12 @@ sp_permtransfer(castorder *co) change_maxspellpoints(tu, aura/3); } - sprintf(buf, "%s opfert %s %d Aura.", unitname(mage), unitname(tu), aura); - addmessage(r, mage->faction, buf, MSG_MAGIC, ML_INFO); + msg = msg_message("sp_permtransfer_effect", "mage target amount", mage, tu, aura); + add_message(&mage->faction->msgs, msg); + if (tu->faction!=mage->faction) { + add_message(&tu->faction->msgs, msg); + } + msg_release(msg); return cast_level; } @@ -6187,7 +6196,7 @@ sp_movecastle(castorder *co) unit *mage = co->magician.u; int cast_level = co->level; spellparameter *pa = co->par; - const spell *sp = co->sp; + message* msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ if (pa->param[0]->flag == TARGET_NOTFOUND) return 0; @@ -6202,22 +6211,14 @@ sp_movecastle(castorder *co) } if (b->size > (cast_level-12) * 250) { - sprintf(buf, "%s in %s: 'ZAUBER %s': Der Elementar ist " - "zu klein, um das Gebäude zu tragen.", unitname(mage), - regionname(mage->region, mage->faction), spell_name(sp, mage->faction->locale)); - addmessage(0, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); + ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "sp_movecastle_fail_0", "")); return cast_level; } target_region = rconnect(r,dir); if (!(target_region->terrain->flags & LAND_REGION)) { - sprintf(buf, "%s in %s: 'ZAUBER %s': Der Erdelementar " - "weigert sich, nach %s zu gehen.", - unitname(mage), regionname(mage->region, mage->faction), - spell_name(sp, mage->faction->locale), - locale_string(mage->faction->locale, directions[dir])); - addmessage(0, mage->faction, buf, MSG_MAGIC, ML_MISTAKE); + ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "sp_movecastle_fail_1", "direction", dir)); return cast_level; } @@ -6237,10 +6238,6 @@ sp_movecastle(castorder *co) u = unext; } - sprintf(buf, "Ein Beben erschüttert %s. Viele kleine Pseudopodien " - "erheben das Gebäude und tragen es in Richtung %s.", - buildingname(b), locale_string(mage->faction->locale, directions[dir])); - if ((b->type==bt_find("caravan") || b->type==bt_find("dam") || b->type==bt_find("tunnel"))) { boolean damage = false; direction_t d; @@ -6250,9 +6247,12 @@ sp_movecastle(castorder *co) damage = true; } } - if (damage) strcat(buf, " Die Straßen der Region wurden beschädigt."); +/* if (damage) strcat(buf, " Die Straßen der Region wurden beschädigt."); */ } - addmessage(r, 0, buf, MSG_MAGIC, ML_INFO); + + msg = msg_message("sp_movecastle_effect", "building direction", b, dir); + r_addmessage(r, NULL, msg); + msg_release(msg); return cast_level; } diff --git a/src/res/messages.xml b/src/res/messages.xml index 25da610fd..9b644bfd9 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -1251,6 +1251,24 @@ "$unit($mage) kümmert sich um die Verletzten und benutzt ein $resource($item,1), um den Zauber zu verstärken. $int($amount) Verwundete werden geheilt." + + + + + + + "Mit einem Ritual bindet $unit($mage) die magischen Kräfte der Erde von $region($region) in die Mauern von $building($building)." + + + + + + + + + "$unit($mage) opfert $unit($target) $int($amount) Aura." + + @@ -1575,8 +1593,31 @@ "$unit($unit) in $region($region): '$order($command)' - $unit($target) kann keine $race($race,1)-Gestalt annehmen." - "$unit($unit) in $region($region): '$order($command)' - $unit($target) cannot assume the shape of a $race($race,1)." + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - Der Elementar ist zu klein, um das Gebäude zu tragen." + + + + + + + + + + + "$unit($unit) in $region($region): '$order($command)' - Der Elementar weigert sich, nach $direction($direction) zu gehen." + + "$unit($unit) in $region($region): '$order($command)' - The elemental refuses to go $direction($direction)." + + + @@ -1607,6 +1648,7 @@ "$unit($unit) in $region($region): '$order($command)' - $unit($unit) ruft Drachen nach $region($target)." "$unit($unit) in $region($region): '$order($command)' - $unit($unit) calls dragons to $region($target)." + @@ -1619,6 +1661,15 @@ "$unit($unit) in $region($region): '$order($command)' - $unit($unit) creates $int($amount) ${item}." "$unit($unit) in $region($region): '$order($command)' - $unit($unit) creates $int($amount) ${item}." + + + + + + + "Ein Beben erschüttert $building($building). Viele kleine Pseudopodien erheben das Gebäude und tragen es in Richtung $direction($direction)." + + @@ -7270,15 +7321,35 @@ "$unit($mage) beschwört $int($number) Dämonen aus dem Reich der Schatten." "$unit($mage) summons $int($number) demons from the realm of shadows." + - - "$unit($mage) zaubert $spell($spell)$if($strlen($effect),": $effect","")." - "$unit($mage) casts $spell($spell)$if($strlen($effect),": $effect","")." + "$unit($mage) zaubert $spell($spell)." + "$unit($mage) casts $spell($spell)." + + + + + + + + + "$unit($mage) zaubert $spell($spell). $int($amount) Krieger verloren Erinnerungen, $int($dead) wurden getötet." + + + + + + + + + "$unit($mage) ruft $int($amount) $race($race, 0) zu Hilfe." + +