diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c index 740df25dd..25b03ec6f 100644 --- a/src/common/gamecode/creport.c +++ b/src/common/gamecode/creport.c @@ -239,31 +239,23 @@ print_curses(FILE * F, const faction * viewer, const void * obj, typ_t typ) } while (a) { - int dh = 0; - curse *c; - if (fval(a->type, ATF_CURSE)) { + curse * c = (curse *)a->data.v; + message * msg; - c = (curse *)a->data.v; - if (c->type->curseinfo) { - if (c->type->cansee) { - self = c->type->cansee(viewer, obj, typ, c, self); - } - dh = c->type->curseinfo(viewer->locale, obj, typ, c, self); + if (c->type->cansee) { + self = c->type->cansee(viewer, obj, typ, c, self); } - if (dh==0) { - if (c->type->info_str!=NULL) { - sprintf(buf, "%s (%s)", c->type->info_str, itoa36(c->no)); - } else { - log_error(("no curseinfo for %s\n", c->type->cname)); - sprintf(buf, "an unknown curse lies on the region. (%s)", itoa36(c->no)); - } - } else { + msg = msg_curse(c, obj, typ, self); + + if (msg) { if (!header) { header = 1; fputs("EFFECTS\n", F); } + nr_render(msg, viewer->locale, buf, sizeof(buf), NULL); fprintf(F, "\"%s\"\n", buf); + msg_release(msg); } } else if (a->type==&at_effect && self) { effect_data * data = (effect_data *)a->data.v; diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 02951cbd7..485b0766f 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -498,9 +498,18 @@ print_curses(FILE *F, const faction *viewer, const void * obj, typ_t typ, int in if (fval(a->type, ATF_CURSE)) { curse *c = (curse *)a->data.v; - if (print_curse(c, viewer, obj, typ, self)) { + message * msg; + + if (c->type->cansee) { + self = c->type->cansee(viewer, obj, typ, c, self); + } + msg = msg_curse(c, obj, typ, self); + + if (msg) { rnl(F); + nr_render(msg, viewer->locale, buf, sizeof(buf), NULL); rparagraph(F, buf, indent, 2, 0); + msg_release(msg); } } else if (a->type==&at_effect && self) { effect_data * data = (effect_data *)a->data.v; diff --git a/src/common/kernel/curse.c b/src/common/kernel/curse.c index 3e12a2354..90886bbe4 100644 --- a/src/common/kernel/curse.c +++ b/src/common/kernel/curse.c @@ -736,8 +736,8 @@ oldcursename(int id) } /* ------------------------------------------------------------- */ -int -cinfo_simple(const struct locale * lang, const void * obj, typ_t typ, const struct curse *c, int self) +message * +cinfo_simple(const void * obj, typ_t typ, const struct curse *c, int self) { struct message * msg; @@ -746,11 +746,8 @@ cinfo_simple(const struct locale * lang, const void * obj, typ_t typ, const stru unused(obj); msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no); - if (msg) { - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; + if (msg==NULL) { + log_error(("There is no curseinfo for %s.\n", c->type->cname)); } - log_warning(("There is no curseinfo for %s.\n", c->type->cname)); - return 0; + return msg; } diff --git a/src/common/kernel/curse.h b/src/common/kernel/curse.h index b8058b693..979aec80c 100644 --- a/src/common/kernel/curse.h +++ b/src/common/kernel/curse.h @@ -222,7 +222,7 @@ typedef struct curse_type { unsigned int mergeflags; const char *info_str; /* Wirkung des curse, wird bei einer gelungenen Zauberanalyse angezeigt */ - int (*curseinfo)(const struct locale*, const void*, typ_t, const curse*, int); + struct message * (*curseinfo)(const void*, typ_t, const curse*, int); void (*change_vigour)(curse*, double); int (*read)(FILE * F, curse * c); int (*write)(FILE * F, const curse * c); @@ -325,7 +325,7 @@ extern boolean curse_active(const curse * c); /*** COMPATIBILITY MACROS. DO NOT USE FOR NEW CODE, REPLACE IN OLD CODE: */ extern const char * oldcursename(int id); extern void register_curses(void); -extern int cinfo_simple(const struct locale * lang, const void * obj, typ_t typ, const struct curse *c, int self); +extern struct message * cinfo_simple(const void * obj, typ_t typ, const struct curse *c, int self); #define is_cursed(a, id, id2) \ curse_active(get_curse(a, ct_find(oldcursename(id)))) diff --git a/src/common/kernel/objtypes.h b/src/common/kernel/objtypes.h index 5fe147768..38742a003 100644 --- a/src/common/kernel/objtypes.h +++ b/src/common/kernel/objtypes.h @@ -20,14 +20,14 @@ extern "C" { #endif enum { - TYP_UNIT, - TYP_REGION, - TYP_BUILDING, - TYP_SHIP, - TYP_FACTION, - TYP_ACTION, - TYP_TRIGGER, - TYP_TIMEOUT + TYP_UNIT, + TYP_REGION, + TYP_BUILDING, + TYP_SHIP, + TYP_FACTION, + TYP_ACTION, + TYP_TRIGGER, + TYP_TIMEOUT }; #ifdef __cplusplus diff --git a/src/common/kernel/reports.c b/src/common/kernel/reports.c index fded06910..3b8de9a89 100644 --- a/src/common/kernel/reports.c +++ b/src/common/kernel/reports.c @@ -809,22 +809,19 @@ spunit(struct strlist ** SP, const struct faction * f, const unit * u, int inden lparagraph(SP, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-'))); } -int -print_curse(const struct curse * c, const struct faction * viewer, const void * obj, typ_t typ, int self) +struct message * +msg_curse(const struct curse * c, const void * obj, typ_t typ, int self) { if (c->type->curseinfo) { - if (c->type->cansee) { - self = c->type->cansee(viewer, obj, typ, c, self); - } - return c->type->curseinfo(viewer->locale, obj, typ, c, self); + /* if curseinfo returns NULL, then we don't want to tell the viewer anything. */ + return c->type->curseinfo(obj, typ, c, self); + } else if (c->type->info_str!=NULL) { + return msg_message(mkname("curseinfo", "info_str"), "info, id", c->type->info_str, c->no); } else { - if (c->type->info_str!=NULL) { - sprintf(buf, "%s (%s)", c->type->info_str, itoa36(c->no)); - return 1; - } + const char * unknown[] = { "unit_unknown", "region_unknown", "building_unknown", "ship_unknown" }; + log_error(("no curseinfo for %s\n", c->type->cname)); + return msg_message(mkname("curseinfo", unknown[typ]), "id", c->no); } - log_error(("no curseinfo for %s\n", c->type->cname)); - return 0; } const struct unit * diff --git a/src/common/kernel/reports.h b/src/common/kernel/reports.h index 073861e4e..f0cd9e044 100644 --- a/src/common/kernel/reports.h +++ b/src/common/kernel/reports.h @@ -110,7 +110,7 @@ extern const char * report_kampfstatus(const struct unit * u, const struct local extern int update_nmrs(void); extern int * nmrs; - extern int print_curse(const struct curse * c, const struct faction * viewer, const void * obj, typ_t typ, int self); + extern struct message * msg_curse(const struct curse * c, const void * obj, typ_t typ, int slef); #ifdef __cplusplus } diff --git a/src/common/spells/buildingcurse.c b/src/common/spells/buildingcurse.c index 28d4aefcf..509b0bd9e 100644 --- a/src/common/spells/buildingcurse.c +++ b/src/common/spells/buildingcurse.c @@ -33,26 +33,19 @@ #include -static int +static message * cinfo_building(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) { - message * msg; - unused(typ); assert(typ == TYP_BUILDING); if (self != 0){ /* owner or inside */ - msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no); + return msg_message(mkname("curseinfo", c->type->cname), "id", c->no); } else { /* outside */ - msg = msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no); - } - if (msg) { - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; + return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no); } log_warning(("There is no curseinfo for %s.\n", c->type->cname)); - return 0; + return NULL; } /* CurseInfo mit Spezialabfragen */ diff --git a/src/common/spells/regioncurse.c b/src/common/spells/regioncurse.c index 15fd94e63..34711d054 100644 --- a/src/common/spells/regioncurse.c +++ b/src/common/spells/regioncurse.c @@ -41,29 +41,19 @@ /* * godcursezone */ -static int -cinfo_cursed_by_the_gods(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_cursed_by_the_gods(const void * obj, typ_t typ, const curse *c, int self) { - region *r; - message * msg; + region *r = (region *)obj;; unused(typ); unused(self); - assert(typ == TYP_REGION); - r = (region *)obj; + if (fval(r->terrain, SEA_REGION)) { - msg = msg_message("curseinfo::godcurseocean", "id", c->no); - } else { - msg = msg_message("curseinfo::godcurse", "id", c->no); + return msg_message("curseinfo::godcurseocean", "id", c->no); } - if (msg!=NULL) { - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - - return 1; - } - return 0; + return msg_message("curseinfo::godcurse", "id", c->no); } static struct curse_type ct_godcursezone = { @@ -81,27 +71,18 @@ static struct curse_type ct_godcursezone = { /* * C_GBDREAM */ -static int -cinfo_dreamcurse(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_dreamcurse(const void * obj, typ_t typ, const curse *c, int self) { - message * msg; - unused(self); unused(typ); unused(obj); assert(typ == TYP_REGION); if (curse_geteffect(c) > 0) { - msg = msg_message("curseinfo::gooddream", "id", c->no); - } else { - msg = msg_message("curseinfo::baddream", "id", c->no); + return msg_message("curseinfo::gooddream", "id", c->no); } - if (msg!=NULL) { - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; - } - return 0; + return msg_message("curseinfo::baddream", "id", c->no); } static struct curse_type ct_gbdream = { @@ -116,29 +97,19 @@ static struct curse_type ct_gbdream = { * C_MAGICSTREET * erzeugt Straßennetz */ -static int -cinfo_magicstreet(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_magicstreet(const void * obj, typ_t typ, const curse *c, int self) { - message * msg; - unused(typ); unused(self); unused(obj); - assert(typ == TYP_REGION); /* Warnung vor Auflösung */ if (c->duration <= 2) { - msg = msg_message("curseinfo::magicstreet", "id", c->no); - } else { - msg = msg_message("curseinfo::magicstreetwarn", "id", c->no); + return msg_message("curseinfo::magicstreet", "id", c->no); } - if (msg!=NULL) { - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; - } - return 0; + return msg_message("curseinfo::magicstreetwarn", "id", c->no); } static struct curse_type ct_magicstreet = { @@ -152,28 +123,20 @@ static struct curse_type ct_magicstreet = { /* --------------------------------------------------------------------- */ -static int -cinfo_antimagiczone(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_antimagiczone(const void * obj, typ_t typ, const curse *c, int self) { - message * msg; - unused(typ); unused(self); unused(obj); - assert(typ == TYP_REGION); /* Magier spüren eine Antimagiezone */ - if (self == 2 || self == 1) { - msg = msg_message("curseinfo::antimagiczone", "id", c->no); - if (msg) { - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; - } + if (self != 0) { + return msg_message("curseinfo::antimagiczone", "id", c->no); } - return 0; + return NULL; } /* alle Magier können eine Antimagiezone wahrnehmen */ @@ -211,25 +174,20 @@ static struct curse_type ct_antimagiczone = { }; /* --------------------------------------------------------------------- */ -static int -cinfo_farvision(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_farvision(const void * obj, typ_t typ, const curse *c, int self) { - message * msg; + unused(typ); + unused(obj); - unused(typ); - unused(obj); + assert(typ == TYP_REGION); - assert(typ == TYP_REGION); + /* Magier spüren eine farvision */ + if (self != 0) { + return msg_message("curseinfo::farvision", "id", c->no); + } - /* Magier spüren eine farvision */ - if (self != 0) { - msg = msg_message("curseinfo::farvision", "id", c->no); - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; - } - - return 0; + return 0; } static struct curse_type ct_farvision = { diff --git a/src/common/spells/shipcurse.c b/src/common/spells/shipcurse.c index 7144c53ca..e3397b5ac 100644 --- a/src/common/spells/shipcurse.c +++ b/src/common/spells/shipcurse.c @@ -32,8 +32,8 @@ #include -int -cinfo_ship(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +message * +cinfo_ship(const void * obj, typ_t typ, const curse *c, int self) { message * msg; @@ -44,22 +44,19 @@ cinfo_ship(const struct locale * lang, const void * obj, typ_t typ, const curse if (self != 0) { /* owner or inside */ msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no); } else { - msg = msg_message(mkname("curseinfo", "shipunknown"), "id", c->no); + msg = msg_message("curseinfo::shipunknown", "id", c->no); } - if (msg) { - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; + if (msg==NULL) { + log_error(("There is no curseinfo for %s.\n", c->type->cname)); } - log_warning(("There is no curseinfo for %s.\n", c->type->cname)); - return 0; + return msg; } /* CurseInfo mit Spezialabfragen */ /* C_SHIP_NODRIFT */ -static int -cinfo_shipnodrift(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_shipnodrift(const void * obj, typ_t typ, const curse *c, int self) { ship * sh; unused(typ); @@ -74,12 +71,9 @@ cinfo_shipnodrift(const struct locale * lang, const void * obj, typ_t typ, const } scat("."); } else { - sprintf(buf, "Ein silberner Schimmer umgibt das Schiff."); + sprintf(buf, "Ein silberner Schimmer umgibt das Schiff"); } - scat(" ("); - scat(itoa36(c->no)); - scat(")"); - return 1; + return msg_message("curseinfo::info_str", buf, c->no); } static struct curse_type ct_stormwind = { "stormwind", diff --git a/src/common/spells/shipcurse.h b/src/common/spells/shipcurse.h index 4384f7f38..3231c9cbc 100644 --- a/src/common/spells/shipcurse.h +++ b/src/common/spells/shipcurse.h @@ -18,8 +18,8 @@ extern "C" { #endif struct locale; -struct curse; -extern int cinfo_ship(const struct locale * lang, const void * obj, typ_t typ, const struct curse *c, int self); +struct message; +extern struct message * cinfo_ship(const void * obj, typ_t typ, const struct curse *c, int self); extern void register_shipcurse(void); #ifdef __cplusplus diff --git a/src/common/spells/unitcurse.c b/src/common/spells/unitcurse.c index 6b0b00916..a5f10dbbd 100644 --- a/src/common/spells/unitcurse.c +++ b/src/common/spells/unitcurse.c @@ -40,8 +40,8 @@ * C_AURA */ /* erhöht/senkt regeneration und maxaura um effect% */ -static int -cinfo_auraboost(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_auraboost(const void * obj, typ_t typ, const curse *c, int self) { struct unit *u; unused(typ); @@ -51,14 +51,14 @@ cinfo_auraboost(const struct locale * lang, const void * obj, typ_t typ, const c if (self != 0){ if (curse_geteffect(c) > 100){ sprintf(buf, "%s fühlt sich von starken magischen Energien " - "durchströmt. (%s)", u->name, curseid(c)); + "durchströmt", u->name); } else { sprintf(buf, "%s hat Schwierigkeiten seine magischen Energien " - "zu sammeln. (%s)", u->name, curseid(c)); + "zu sammeln", u->name); } - return 1; + return msg_message("curseinfo::info_str", "text id", buf, c->no); } - return 0; + return NULL; } static struct curse_type ct_auraboost = { "auraboost", @@ -81,8 +81,8 @@ static struct curse_type ct_magicboost = { /* * C_SLAVE */ -static int -cinfo_slave(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_slave(const void * obj, typ_t typ, const curse *c, int self) { unit *u; unused(typ); @@ -91,11 +91,9 @@ cinfo_slave(const struct locale * lang, const void * obj, typ_t typ, const curse u = (unit *)obj; if (self != 0){ - sprintf(buf, "%s wird noch %d Woche%s unter unserem Bann stehen. (%s)", - u->name, c->duration, (c->duration == 1)? "":"n", curseid(c)); - return 1; + return msg_message("curseinfo::slave_1", "unit duration id", u, c->duration, c->no); } - return 0; + return NULL; } static struct curse_type ct_slavery = { "slavery", CURSETYP_NORM, 0, NO_MERGE, @@ -109,31 +107,23 @@ static struct curse_type ct_slavery = { "slavery", /* * C_CALM */ -static int -cinfo_calm(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_calm(const void * obj, typ_t typ, const curse *c, int self) { - unit *u; - const struct race * rc; - faction *f; unused(typ); - assert(typ == TYP_UNIT); - u = (unit *)obj; + if (c->magician && c->magician->faction) { - rc = c->magician->irace; - f = c->magician->faction; - if (f!=NULL && self != 0) { - sprintf(buf, "%s mag %s", u->name, factionname(f)); - } else { - sprintf(buf, "%s scheint %s zu mögen", u->name, LOC(lang, rc_name(rc, 1))); - } - scat(". ("); - scat(itoa36(c->no)); - scat(")"); + faction *f = c->magician->faction; + unit *u = (unit *)obj; - return 1; + if (f==NULL || self == 0) { + const struct race * rc = c->magician->irace; + return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no); + } + return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no); } - return 0; + return NULL; } static struct curse_type ct_calmmonster = { "calmmonster", CURSETYP_NORM, CURSE_SPREADNEVER, NO_MERGE, @@ -146,26 +136,18 @@ static struct curse_type ct_calmmonster = { "calmmonster", /* * C_SPEED */ -static int -cinfo_speed(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_speed(const void * obj, typ_t typ, const curse *c, int self) { - unit *u; - curse_unit * cu; unused(typ); - assert(typ == TYP_UNIT); - u = (unit *)obj; - cu = (curse_unit *)c->data.v; if (self != 0){ - sprintf(buf, "%d Person%s von %s %s noch %d Woche%s beschleunigt. (%s)", - cu->cursedmen, (cu->cursedmen == 1)? "":"en", u->name, - (cu->cursedmen == 1)? "ist":"sind", c->duration, - (c->duration == 1)? "":"n", - curseid(c)); - return 1; + unit *u = (unit *)obj; + curse_unit * cu = (curse_unit *)c->data.v; + return msg_message("curseinfo::speed_1", "unit number duration id", u, cu->cursedmen, c->duration, c->no); } - return 0; + return NULL; } static struct curse_type ct_speed = { "speed", @@ -178,23 +160,17 @@ static struct curse_type ct_speed = { /* * C_ORC */ -int -cinfo_unit(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +message * +cinfo_unit(const void * obj, typ_t typ, const curse *c, int self) { - unit *u; - message * msg; unused(typ); - assert(typ == TYP_UNIT); - u = (unit *)obj; if (self != 0){ - msg = msg_message(mkname("curseinfo", c->type->cname), "unit id", u, c->no); - nr_render(msg, lang, buf, sizeof(buf), NULL); - msg_release(msg); - return 1; + unit * u = (unit *)obj; + return msg_message(mkname("curseinfo", c->type->cname), "unit id", u, c->no); } - return 0; + return NULL; } static struct curse_type ct_orcish = { @@ -209,25 +185,18 @@ static struct curse_type ct_orcish = { /* * C_KAELTESCHUTZ */ -static int -cinfo_kaelteschutz(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_kaelteschutz(const void * obj, typ_t typ, const curse *c, int self) { - unit *u; - curse_unit * cu; unused(typ); - assert(typ == TYP_UNIT); - u = (unit *)obj; - cu = (curse_unit *)c->data.v; - if (self != 0){ - sprintf(buf, "%d Person%s von %s %s sich vor Kälte geschützt. (%s)", - cu->cursedmen, (cu->cursedmen == 1)? "":"en", u->name, - (cu->cursedmen == 1)? "fühlt":"fühlen", - curseid(c)); - return 1; + if (self != 0) { + unit * u = (unit *)obj; + curse_unit *cu = (curse_unit *)c->data.v; + return msg_message("curseinfo::warmth_1", "unit number id", u, cu->cursedmen, c->no); } - return 0; + return NULL; } static struct curse_type ct_insectfur = { "insectfur", @@ -240,33 +209,33 @@ static struct curse_type ct_insectfur = { /* * C_SPARKLE */ -static int -cinfo_sparkle(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_sparkle(const void * obj, typ_t typ, const curse *c, int self) { const char * effects[] = { NULL, /* end grau*/ - "%s ist im Traum eine Fee erschienen.", - "%s wird von bösen Alpträumen geplagt.", + "%s ist im Traum eine Fee erschienen", + "%s wird von bösen Alpträumen geplagt", NULL, /* end traum */ - "%s wird von einem glitzernden Funkenregen umgeben.", - "Ein schimmernder Lichterkranz umgibt %s.", + "%s wird von einem glitzernden Funkenregen umgeben", + "Ein schimmernder Lichterkranz umgibt %s", NULL, /* end tybied */ - "Eine Melodie erklingt, und %s tanzt bis spät in die Nacht hinein.", - "%s findet eine kleine Flöte, die eine wundersame Melodie spielt.", - "Die Frauen des nahegelegenen Dorfes bewundern %s verstohlen.", - "Eine Gruppe vorbeiziehender Bergarbeiter rufen %s eindeutig Zweideutiges nach.", + "Eine Melodie erklingt, und %s tanzt bis spät in die Nacht hinein", + "%s findet eine kleine Flöte, die eine wundersame Melodie spielt", + "Die Frauen des nahegelegenen Dorfes bewundern %s verstohlen", + "Eine Gruppe vorbeiziehender Bergarbeiter rufen %s eindeutig Zweideutiges nach", NULL, /* end cerrdor */ - "%s bekommt von einer Schlange einen Apfel angeboten.", - "Ein Einhorn berührt %s mit seinem Horn und verschwindet kurz darauf im Unterholz.", - "Vogelzwitschern begleitet %s auf all seinen Wegen.", - "Leuchtende Blumen erblühen rund um das Lager von %s.", + "%s bekommt von einer Schlange einen Apfel angeboten", + "Ein Einhorn berührt %s mit seinem Horn und verschwindet kurz darauf im Unterholz", + "Vogelzwitschern begleitet %s auf all seinen Wegen", + "Leuchtende Blumen erblühen rund um das Lager von %s", NULL, /* end gwyrrd */ - "Über %s zieht eine Gruppe Geier ihre Kreise.", - "Der Kopf von %s hat sich in einen grinsenden Totenschädel verwandelt.", - "Ratten folgen %s auf Schritt und Tritt.", - "Pestbeulen befallen den Körper von %s.", - "Eine dunkle Fee erscheint %s im Schlaf. Sie ist von schauriger Schönheit.", - "Fäulnisgeruch dringt %s aus allen Körperöffnungen.", + "Über %s zieht eine Gruppe Geier ihre Kreise", + "Der Kopf von %s hat sich in einen grinsenden Totenschädel verwandelt", + "Ratten folgen %s auf Schritt und Tritt", + "Pestbeulen befallen den Körper von %s", + "Eine dunkle Fee erscheint %s im Schlaf. Sie ist von schauriger Schönheit", + "Fäulnisgeruch dringt %s aus allen Körperöffnungen", NULL, /* end draig */ }; int m, begin=0, end=0; @@ -276,22 +245,19 @@ cinfo_sparkle(const struct locale * lang, const void * obj, typ_t typ, const cur assert(typ == TYP_UNIT); u = (unit *)obj; - if(!c->magician || !c->magician->faction) return 0; + if (!c->magician || !c->magician->faction) return NULL; - for(m=0;m!=c->magician->faction->magiegebiet;++m) { + for (m=0;m!=c->magician->faction->magiegebiet;++m) { while (effects[end]!=NULL) ++end; begin = end+1; end = begin; } while (effects[end]!=NULL) ++end; - if (end==begin) return 0; + if (end==begin) return NULL; else sprintf(buf, effects[begin + curse_geteffect(c) % (end-begin)], u->name); - scat(" ("); - scat(itoa36(c->no)); - scat(")"); - return 1; + return msg_message("curseinfo::info_str", "info id", buf, c->no); } static struct curse_type ct_sparkle = { "sparkle", CURSETYP_UNIT, CURSE_SPREADMODULO, ( M_MEN | M_DURATION ), @@ -382,20 +348,17 @@ write_skill(FILE * F, const curse * c) return 0; } -static int -cinfo_skill(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) +static message * +cinfo_skill(const void * obj, typ_t typ, const curse *c, int self) { - unit *u = (unit *)obj; - int sk = c->data.i; - unused(typ); - if (self != 0){ - sprintf(buf, "%s ist in %s ungewöhnlich ungeschickt. (%s)", u->name, - skillname((skill_t)sk, u->faction->locale), curseid(c)); - return 1; + if (self != 0) { + unit *u = (unit *)obj; + int sk = c->data.i; + return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no); } - return 0; + return NULL; } static struct curse_type ct_skillmod = { diff --git a/src/common/spells/unitcurse.h b/src/common/spells/unitcurse.h index a5c9ec5fb..129936337 100644 --- a/src/common/spells/unitcurse.h +++ b/src/common/spells/unitcurse.h @@ -18,8 +18,8 @@ extern "C" { #endif struct curse; -struct locale; -extern int cinfo_unit(const struct locale * lang, const void * obj, typ_t typ, const struct curse *c, int self); +struct message; +extern struct message * cinfo_unit(const void * obj, typ_t typ, const struct curse *c, int self); extern void register_unitcurse(void); diff --git a/src/res/messages.xml b/src/res/messages.xml index ee737296e..ede969722 100644 --- a/src/res/messages.xml +++ b/src/res/messages.xml @@ -39,6 +39,96 @@ "$unit($mage) beschwört einen Schleier der Verwirrung." "$unit($mage) summons a fog of confusion." + + + + + + + "$unit($unit) mag $faction($faction) zu mögen. ($int36($id))" + "$unit($unit) likes $faction($faction). ($int36($id))" + + + + + + + + "$unit($unit) scheint $race($race, 0) zu mögen. ($int36($id))" + "$unit($unit) seems to like $race($race, 0). ($int36($id))" + + + + + + + + "$unit($unit) ist ungewöhnlich geschickt in $skill($skill). ($int36($id))" + "$unit($unit) is incredibly skilled at $skill($skill). ($int36($id))" + + + + + + + + "$unit($unit) wird noch $int($duration) $if($eq($duration,1), "Woche", "Wochen") unter unserem Bann stehen. ($int36($id))" + "$unit($unit) will be under our influence for $int($duration) more $if($eq($duration,1), "week", "weeks"). ($int36($id))" + + + + + + + + + "$int($number) $if($eq($number,1), "Person", "Personen") von $unit($unit) $if($eq($number,1), "ist", "sind") noch $int($duration) $if($eq($duration,1), "Woche", "Wochen") beschleunigt. ($int36($id))" + "$int($number) $if($eq($number,1), "member", "members") of $unit($unit) $if($eq($number,1), "is", "are") accelerated for $int($duration) more $if($eq($duration,1), "week", "weeks"). ($int36($id))" + + + + + + + + "$int($number) $if($eq($number,1), "Person", "Personen") von $unit($unit) $if($eq($number,1), "fühlt", "fühlen") sich vor Kälte geschützt. ($int36($id))" + "$int($number) $if($eq($number,1), "member", "members") of $unit($unit) $if($eq($number,1), "is", "are") protected from the cold. ($int36($id))" + + + + + + + "${info}. ($int36($id))" + + + + + + "Ein unbekannter Zauber liegt auf dem Schiff. ($int36($id))" + "An unknown spell lies on this ship. ($int36($id))" + + + + + + "Ein unbekannter Zauber liegt auf der Einheit. ($int36($id))" + "An unknown spell lies on this unit. ($int36($id))" + + + + + + "Ein unbekannter Zauber liegt auf dem Gebäude. ($int36($id))" + "An unknown spell lies on this building. ($int36($id))" + + + + + + "Ein unbekannter Zauber liegt auf der Region. ($int36($id))" + "An unknown spell lies on this region. ($int36($id))" + @@ -52,7 +142,6 @@ "Die Leute strotzen nur so vor Kraft. ($int36($id))" - "Testosterone levels are at an all-time high. ($int36($id))" "Testosterone levels are at an all-time high. ($int36($id))" @@ -61,7 +150,6 @@ "$unit($unit) wird von einem Alp geritten. ($int36($id))" - "$unit($unit) is chased by a nightmare. ($int36($id))" "$unit($unit) is chased by a nightmare. ($int36($id))"