- All the cinfo_* functions will now return a message * object, which is nicer than using buf[].

- Some English translation.
This commit is contained in:
Enno Rehling 2007-03-09 21:30:00 +00:00
parent da224f6670
commit 1030e44c07
14 changed files with 251 additions and 260 deletions

View File

@ -239,31 +239,23 @@ print_curses(FILE * F, const faction * viewer, const void * obj, typ_t typ)
} }
while (a) { while (a) {
int dh = 0;
curse *c;
if (fval(a->type, ATF_CURSE)) { 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) { if (c->type->cansee) {
self = c->type->cansee(viewer, obj, typ, c, self); self = c->type->cansee(viewer, obj, typ, c, self);
} }
dh = c->type->curseinfo(viewer->locale, obj, typ, c, self); msg = msg_curse(c, obj, typ, self);
}
if (dh==0) { if (msg) {
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 {
if (!header) { if (!header) {
header = 1; header = 1;
fputs("EFFECTS\n", F); fputs("EFFECTS\n", F);
} }
nr_render(msg, viewer->locale, buf, sizeof(buf), NULL);
fprintf(F, "\"%s\"\n", buf); fprintf(F, "\"%s\"\n", buf);
msg_release(msg);
} }
} else if (a->type==&at_effect && self) { } else if (a->type==&at_effect && self) {
effect_data * data = (effect_data *)a->data.v; effect_data * data = (effect_data *)a->data.v;

View File

@ -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)) { if (fval(a->type, ATF_CURSE)) {
curse *c = (curse *)a->data.v; 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); rnl(F);
nr_render(msg, viewer->locale, buf, sizeof(buf), NULL);
rparagraph(F, buf, indent, 2, 0); rparagraph(F, buf, indent, 2, 0);
msg_release(msg);
} }
} else if (a->type==&at_effect && self) { } else if (a->type==&at_effect && self) {
effect_data * data = (effect_data *)a->data.v; effect_data * data = (effect_data *)a->data.v;

View File

@ -736,8 +736,8 @@ oldcursename(int id)
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
int message *
cinfo_simple(const struct locale * lang, const void * obj, typ_t typ, const struct curse *c, int self) cinfo_simple(const void * obj, typ_t typ, const struct curse *c, int self)
{ {
struct message * msg; struct message * msg;
@ -746,11 +746,8 @@ cinfo_simple(const struct locale * lang, const void * obj, typ_t typ, const stru
unused(obj); unused(obj);
msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no); msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
if (msg) { if (msg==NULL) {
nr_render(msg, lang, buf, sizeof(buf), NULL); log_error(("There is no curseinfo for %s.\n", c->type->cname));
msg_release(msg);
return 1;
} }
log_warning(("There is no curseinfo for %s.\n", c->type->cname)); return msg;
return 0;
} }

View File

@ -222,7 +222,7 @@ typedef struct curse_type {
unsigned int mergeflags; unsigned int mergeflags;
const char *info_str; /* Wirkung des curse, wird bei einer gelungenen const char *info_str; /* Wirkung des curse, wird bei einer gelungenen
Zauberanalyse angezeigt */ 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); void (*change_vigour)(curse*, double);
int (*read)(FILE * F, curse * c); int (*read)(FILE * F, curse * c);
int (*write)(FILE * F, const 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: */ /*** COMPATIBILITY MACROS. DO NOT USE FOR NEW CODE, REPLACE IN OLD CODE: */
extern const char * oldcursename(int id); extern const char * oldcursename(int id);
extern void register_curses(void); 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) \ #define is_cursed(a, id, id2) \
curse_active(get_curse(a, ct_find(oldcursename(id)))) curse_active(get_curse(a, ct_find(oldcursename(id))))

View File

@ -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 ? '+' : '-'))); lparagraph(SP, buf, indent, (char) ((u->faction == f) ? '*' : (dh ? '+' : '-')));
} }
int struct message *
print_curse(const struct curse * c, const struct faction * viewer, const void * obj, typ_t typ, int self) msg_curse(const struct curse * c, const void * obj, typ_t typ, int self)
{ {
if (c->type->curseinfo) { if (c->type->curseinfo) {
if (c->type->cansee) { /* if curseinfo returns NULL, then we don't want to tell the viewer anything. */
self = c->type->cansee(viewer, obj, typ, c, self); return c->type->curseinfo(obj, typ, c, self);
} } else if (c->type->info_str!=NULL) {
return c->type->curseinfo(viewer->locale, obj, typ, c, self); return msg_message(mkname("curseinfo", "info_str"), "info, id", c->type->info_str, c->no);
} else { } else {
if (c->type->info_str!=NULL) { const char * unknown[] = { "unit_unknown", "region_unknown", "building_unknown", "ship_unknown" };
sprintf(buf, "%s (%s)", c->type->info_str, itoa36(c->no));
return 1;
}
}
log_error(("no curseinfo for %s\n", c->type->cname)); log_error(("no curseinfo for %s\n", c->type->cname));
return 0; return msg_message(mkname("curseinfo", unknown[typ]), "id", c->no);
}
} }
const struct unit * const struct unit *

View File

@ -110,7 +110,7 @@ extern const char * report_kampfstatus(const struct unit * u, const struct local
extern int update_nmrs(void); extern int update_nmrs(void);
extern int * nmrs; 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 #ifdef __cplusplus
} }

View File

@ -33,26 +33,19 @@
#include <assert.h> #include <assert.h>
static int static message *
cinfo_building(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_building(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self)
{ {
message * msg;
unused(typ); unused(typ);
assert(typ == TYP_BUILDING); assert(typ == TYP_BUILDING);
if (self != 0){ /* owner or inside */ 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 */ } else { /* outside */
msg = msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no); return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no);
}
if (msg) {
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
} }
log_warning(("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 NULL;
} }
/* CurseInfo mit Spezialabfragen */ /* CurseInfo mit Spezialabfragen */

View File

@ -41,29 +41,19 @@
/* /*
* godcursezone * godcursezone
*/ */
static int static message *
cinfo_cursed_by_the_gods(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_cursed_by_the_gods(const void * obj, typ_t typ, const curse *c, int self)
{ {
region *r; region *r = (region *)obj;;
message * msg;
unused(typ); unused(typ);
unused(self); unused(self);
assert(typ == TYP_REGION); 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);
}
if (msg!=NULL) {
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1; if (fval(r->terrain, SEA_REGION)) {
return msg_message("curseinfo::godcurseocean", "id", c->no);
} }
return 0; return msg_message("curseinfo::godcurse", "id", c->no);
} }
static struct curse_type ct_godcursezone = { static struct curse_type ct_godcursezone = {
@ -81,27 +71,18 @@ static struct curse_type ct_godcursezone = {
/* /*
* C_GBDREAM * C_GBDREAM
*/ */
static int static message *
cinfo_dreamcurse(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_dreamcurse(const void * obj, typ_t typ, const curse *c, int self)
{ {
message * msg;
unused(self); unused(self);
unused(typ); unused(typ);
unused(obj); unused(obj);
assert(typ == TYP_REGION); assert(typ == TYP_REGION);
if (curse_geteffect(c) > 0) { if (curse_geteffect(c) > 0) {
msg = msg_message("curseinfo::gooddream", "id", c->no); return msg_message("curseinfo::gooddream", "id", c->no);
} else {
msg = msg_message("curseinfo::baddream", "id", c->no);
} }
if (msg!=NULL) { return msg_message("curseinfo::baddream", "id", c->no);
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
}
return 0;
} }
static struct curse_type ct_gbdream = { static struct curse_type ct_gbdream = {
@ -116,29 +97,19 @@ static struct curse_type ct_gbdream = {
* C_MAGICSTREET * C_MAGICSTREET
* erzeugt Straßennetz * erzeugt Straßennetz
*/ */
static int static message *
cinfo_magicstreet(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_magicstreet(const void * obj, typ_t typ, const curse *c, int self)
{ {
message * msg;
unused(typ); unused(typ);
unused(self); unused(self);
unused(obj); unused(obj);
assert(typ == TYP_REGION); assert(typ == TYP_REGION);
/* Warnung vor Auflösung */ /* Warnung vor Auflösung */
if (c->duration <= 2) { if (c->duration <= 2) {
msg = msg_message("curseinfo::magicstreet", "id", c->no); return msg_message("curseinfo::magicstreet", "id", c->no);
} else {
msg = msg_message("curseinfo::magicstreetwarn", "id", c->no);
} }
if (msg!=NULL) { return msg_message("curseinfo::magicstreetwarn", "id", c->no);
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
}
return 0;
} }
static struct curse_type ct_magicstreet = { static struct curse_type ct_magicstreet = {
@ -152,28 +123,20 @@ static struct curse_type ct_magicstreet = {
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static int static message *
cinfo_antimagiczone(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_antimagiczone(const void * obj, typ_t typ, const curse *c, int self)
{ {
message * msg;
unused(typ); unused(typ);
unused(self); unused(self);
unused(obj); unused(obj);
assert(typ == TYP_REGION); assert(typ == TYP_REGION);
/* Magier spüren eine Antimagiezone */ /* Magier spüren eine Antimagiezone */
if (self == 2 || self == 1) { if (self != 0) {
msg = msg_message("curseinfo::antimagiczone", "id", c->no); return msg_message("curseinfo::antimagiczone", "id", c->no);
if (msg) {
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
}
} }
return 0; return NULL;
} }
/* alle Magier können eine Antimagiezone wahrnehmen */ /* alle Magier können eine Antimagiezone wahrnehmen */
@ -211,11 +174,9 @@ static struct curse_type ct_antimagiczone = {
}; };
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static int static message *
cinfo_farvision(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_farvision(const void * obj, typ_t typ, const curse *c, int self)
{ {
message * msg;
unused(typ); unused(typ);
unused(obj); unused(obj);
@ -223,10 +184,7 @@ cinfo_farvision(const struct locale * lang, const void * obj, typ_t typ, const c
/* Magier spüren eine farvision */ /* Magier spüren eine farvision */
if (self != 0) { if (self != 0) {
msg = msg_message("curseinfo::farvision", "id", c->no); return msg_message("curseinfo::farvision", "id", c->no);
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
} }
return 0; return 0;

View File

@ -32,8 +32,8 @@
#include <assert.h> #include <assert.h>
int message *
cinfo_ship(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_ship(const void * obj, typ_t typ, const curse *c, int self)
{ {
message * msg; 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 */ if (self != 0) { /* owner or inside */
msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no); msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
} else { } else {
msg = msg_message(mkname("curseinfo", "shipunknown"), "id", c->no); msg = msg_message("curseinfo::shipunknown", "id", c->no);
} }
if (msg) { if (msg==NULL) {
nr_render(msg, lang, buf, sizeof(buf), NULL); log_error(("There is no curseinfo for %s.\n", c->type->cname));
msg_release(msg);
return 1;
} }
log_warning(("There is no curseinfo for %s.\n", c->type->cname)); return msg;
return 0;
} }
/* CurseInfo mit Spezialabfragen */ /* CurseInfo mit Spezialabfragen */
/* C_SHIP_NODRIFT */ /* C_SHIP_NODRIFT */
static int static message *
cinfo_shipnodrift(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_shipnodrift(const void * obj, typ_t typ, const curse *c, int self)
{ {
ship * sh; ship * sh;
unused(typ); unused(typ);
@ -74,12 +71,9 @@ cinfo_shipnodrift(const struct locale * lang, const void * obj, typ_t typ, const
} }
scat("."); scat(".");
} else { } else {
sprintf(buf, "Ein silberner Schimmer umgibt das Schiff."); sprintf(buf, "Ein silberner Schimmer umgibt das Schiff");
} }
scat(" ("); return msg_message("curseinfo::info_str", buf, c->no);
scat(itoa36(c->no));
scat(")");
return 1;
} }
static struct curse_type ct_stormwind = { "stormwind", static struct curse_type ct_stormwind = { "stormwind",

View File

@ -18,8 +18,8 @@ extern "C" {
#endif #endif
struct locale; struct locale;
struct curse; struct message;
extern int cinfo_ship(const struct locale * lang, const void * obj, typ_t typ, const struct curse *c, int self); extern struct message * cinfo_ship(const void * obj, typ_t typ, const struct curse *c, int self);
extern void register_shipcurse(void); extern void register_shipcurse(void);
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -40,8 +40,8 @@
* C_AURA * C_AURA
*/ */
/* erhöht/senkt regeneration und maxaura um effect% */ /* erhöht/senkt regeneration und maxaura um effect% */
static int static message *
cinfo_auraboost(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_auraboost(const void * obj, typ_t typ, const curse *c, int self)
{ {
struct unit *u; struct unit *u;
unused(typ); unused(typ);
@ -51,14 +51,14 @@ cinfo_auraboost(const struct locale * lang, const void * obj, typ_t typ, const c
if (self != 0){ if (self != 0){
if (curse_geteffect(c) > 100){ if (curse_geteffect(c) > 100){
sprintf(buf, "%s fühlt sich von starken magischen Energien " sprintf(buf, "%s fühlt sich von starken magischen Energien "
"durchströmt. (%s)", u->name, curseid(c)); "durchströmt", u->name);
} else { } else {
sprintf(buf, "%s hat Schwierigkeiten seine magischen Energien " 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 = { static struct curse_type ct_auraboost = {
"auraboost", "auraboost",
@ -81,8 +81,8 @@ static struct curse_type ct_magicboost = {
/* /*
* C_SLAVE * C_SLAVE
*/ */
static int static message *
cinfo_slave(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_slave(const void * obj, typ_t typ, const curse *c, int self)
{ {
unit *u; unit *u;
unused(typ); unused(typ);
@ -91,11 +91,9 @@ cinfo_slave(const struct locale * lang, const void * obj, typ_t typ, const curse
u = (unit *)obj; u = (unit *)obj;
if (self != 0){ if (self != 0){
sprintf(buf, "%s wird noch %d Woche%s unter unserem Bann stehen. (%s)", return msg_message("curseinfo::slave_1", "unit duration id", u, c->duration, c->no);
u->name, c->duration, (c->duration == 1)? "":"n", curseid(c));
return 1;
} }
return 0; return NULL;
} }
static struct curse_type ct_slavery = { "slavery", static struct curse_type ct_slavery = { "slavery",
CURSETYP_NORM, 0, NO_MERGE, CURSETYP_NORM, 0, NO_MERGE,
@ -109,31 +107,23 @@ static struct curse_type ct_slavery = { "slavery",
/* /*
* C_CALM * C_CALM
*/ */
static int static message *
cinfo_calm(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_calm(const void * obj, typ_t typ, const curse *c, int self)
{ {
unit *u;
const struct race * rc;
faction *f;
unused(typ); unused(typ);
assert(typ == TYP_UNIT); 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(")");
return 1; if (c->magician && c->magician->faction) {
faction *f = c->magician->faction;
unit *u = (unit *)obj;
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 0; return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no);
}
return NULL;
} }
static struct curse_type ct_calmmonster = { "calmmonster", static struct curse_type ct_calmmonster = { "calmmonster",
CURSETYP_NORM, CURSE_SPREADNEVER, NO_MERGE, CURSETYP_NORM, CURSE_SPREADNEVER, NO_MERGE,
@ -146,26 +136,18 @@ static struct curse_type ct_calmmonster = { "calmmonster",
/* /*
* C_SPEED * C_SPEED
*/ */
static int static message *
cinfo_speed(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_speed(const void * obj, typ_t typ, const curse *c, int self)
{ {
unit *u;
curse_unit * cu;
unused(typ); unused(typ);
assert(typ == TYP_UNIT); assert(typ == TYP_UNIT);
u = (unit *)obj;
cu = (curse_unit *)c->data.v;
if (self != 0){ if (self != 0){
sprintf(buf, "%d Person%s von %s %s noch %d Woche%s beschleunigt. (%s)", unit *u = (unit *)obj;
cu->cursedmen, (cu->cursedmen == 1)? "":"en", u->name, curse_unit * cu = (curse_unit *)c->data.v;
(cu->cursedmen == 1)? "ist":"sind", c->duration, return msg_message("curseinfo::speed_1", "unit number duration id", u, cu->cursedmen, c->duration, c->no);
(c->duration == 1)? "":"n",
curseid(c));
return 1;
} }
return 0; return NULL;
} }
static struct curse_type ct_speed = { static struct curse_type ct_speed = {
"speed", "speed",
@ -178,23 +160,17 @@ static struct curse_type ct_speed = {
/* /*
* C_ORC * C_ORC
*/ */
int message *
cinfo_unit(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_unit(const void * obj, typ_t typ, const curse *c, int self)
{ {
unit *u;
message * msg;
unused(typ); unused(typ);
assert(typ == TYP_UNIT); assert(typ == TYP_UNIT);
u = (unit *)obj;
if (self != 0){ if (self != 0){
msg = msg_message(mkname("curseinfo", c->type->cname), "unit id", u, c->no); unit * u = (unit *)obj;
nr_render(msg, lang, buf, sizeof(buf), NULL); return msg_message(mkname("curseinfo", c->type->cname), "unit id", u, c->no);
msg_release(msg);
return 1;
} }
return 0; return NULL;
} }
static struct curse_type ct_orcish = { static struct curse_type ct_orcish = {
@ -209,25 +185,18 @@ static struct curse_type ct_orcish = {
/* /*
* C_KAELTESCHUTZ * C_KAELTESCHUTZ
*/ */
static int static message *
cinfo_kaelteschutz(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_kaelteschutz(const void * obj, typ_t typ, const curse *c, int self)
{ {
unit *u;
curse_unit * cu;
unused(typ); unused(typ);
assert(typ == TYP_UNIT); assert(typ == TYP_UNIT);
u = (unit *)obj;
cu = (curse_unit *)c->data.v;
if (self != 0) { if (self != 0) {
sprintf(buf, "%d Person%s von %s %s sich vor Kälte geschützt. (%s)", unit * u = (unit *)obj;
cu->cursedmen, (cu->cursedmen == 1)? "":"en", u->name, curse_unit *cu = (curse_unit *)c->data.v;
(cu->cursedmen == 1)? "fühlt":"fühlen", return msg_message("curseinfo::warmth_1", "unit number id", u, cu->cursedmen, c->no);
curseid(c));
return 1;
} }
return 0; return NULL;
} }
static struct curse_type ct_insectfur = { static struct curse_type ct_insectfur = {
"insectfur", "insectfur",
@ -240,33 +209,33 @@ static struct curse_type ct_insectfur = {
/* /*
* C_SPARKLE * C_SPARKLE
*/ */
static int static message *
cinfo_sparkle(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_sparkle(const void * obj, typ_t typ, const curse *c, int self)
{ {
const char * effects[] = { const char * effects[] = {
NULL, /* end grau*/ NULL, /* end grau*/
"%s ist im Traum eine Fee erschienen.", "%s ist im Traum eine Fee erschienen",
"%s wird von bösen Alpträumen geplagt.", "%s wird von bösen Alpträumen geplagt",
NULL, /* end traum */ NULL, /* end traum */
"%s wird von einem glitzernden Funkenregen umgeben.", "%s wird von einem glitzernden Funkenregen umgeben",
"Ein schimmernder Lichterkranz umgibt %s.", "Ein schimmernder Lichterkranz umgibt %s",
NULL, /* end tybied */ NULL, /* end tybied */
"Eine Melodie erklingt, und %s tanzt bis spät in die Nacht hinein.", "Eine Melodie erklingt, und %s tanzt bis spät in die Nacht hinein",
"%s findet eine kleine Flöte, die eine wundersame Melodie spielt.", "%s findet eine kleine Flöte, die eine wundersame Melodie spielt",
"Die Frauen des nahegelegenen Dorfes bewundern %s verstohlen.", "Die Frauen des nahegelegenen Dorfes bewundern %s verstohlen",
"Eine Gruppe vorbeiziehender Bergarbeiter rufen %s eindeutig Zweideutiges nach.", "Eine Gruppe vorbeiziehender Bergarbeiter rufen %s eindeutig Zweideutiges nach",
NULL, /* end cerrdor */ NULL, /* end cerrdor */
"%s bekommt von einer Schlange einen Apfel angeboten.", "%s bekommt von einer Schlange einen Apfel angeboten",
"Ein Einhorn berührt %s mit seinem Horn und verschwindet kurz darauf im Unterholz.", "Ein Einhorn berührt %s mit seinem Horn und verschwindet kurz darauf im Unterholz",
"Vogelzwitschern begleitet %s auf all seinen Wegen.", "Vogelzwitschern begleitet %s auf all seinen Wegen",
"Leuchtende Blumen erblühen rund um das Lager von %s.", "Leuchtende Blumen erblühen rund um das Lager von %s",
NULL, /* end gwyrrd */ NULL, /* end gwyrrd */
"Über %s zieht eine Gruppe Geier ihre Kreise.", "Über %s zieht eine Gruppe Geier ihre Kreise",
"Der Kopf von %s hat sich in einen grinsenden Totenschädel verwandelt.", "Der Kopf von %s hat sich in einen grinsenden Totenschädel verwandelt",
"Ratten folgen %s auf Schritt und Tritt.", "Ratten folgen %s auf Schritt und Tritt",
"Pestbeulen befallen den Körper von %s.", "Pestbeulen befallen den Körper von %s",
"Eine dunkle Fee erscheint %s im Schlaf. Sie ist von schauriger Schönheit.", "Eine dunkle Fee erscheint %s im Schlaf. Sie ist von schauriger Schönheit",
"Fäulnisgeruch dringt %s aus allen Körperöffnungen.", "Fäulnisgeruch dringt %s aus allen Körperöffnungen",
NULL, /* end draig */ NULL, /* end draig */
}; };
int m, begin=0, end=0; int m, begin=0, end=0;
@ -276,7 +245,7 @@ cinfo_sparkle(const struct locale * lang, const void * obj, typ_t typ, const cur
assert(typ == TYP_UNIT); assert(typ == TYP_UNIT);
u = (unit *)obj; 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; while (effects[end]!=NULL) ++end;
@ -285,13 +254,10 @@ cinfo_sparkle(const struct locale * lang, const void * obj, typ_t typ, const cur
} }
while (effects[end]!=NULL) ++end; 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); 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", static struct curse_type ct_sparkle = { "sparkle",
CURSETYP_UNIT, CURSE_SPREADMODULO, ( M_MEN | M_DURATION ), CURSETYP_UNIT, CURSE_SPREADMODULO, ( M_MEN | M_DURATION ),
@ -382,20 +348,17 @@ write_skill(FILE * F, const curse * c)
return 0; return 0;
} }
static int static message *
cinfo_skill(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self) cinfo_skill(const void * obj, typ_t typ, const curse *c, int self)
{ {
unit *u = (unit *)obj;
int sk = c->data.i;
unused(typ); unused(typ);
if (self != 0) { if (self != 0) {
sprintf(buf, "%s ist in %s ungewöhnlich ungeschickt. (%s)", u->name, unit *u = (unit *)obj;
skillname((skill_t)sk, u->faction->locale), curseid(c)); int sk = c->data.i;
return 1; return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no);
} }
return 0; return NULL;
} }
static struct curse_type ct_skillmod = { static struct curse_type ct_skillmod = {

View File

@ -18,8 +18,8 @@ extern "C" {
#endif #endif
struct curse; struct curse;
struct locale; struct message;
extern int cinfo_unit(const struct locale * lang, const void * obj, typ_t typ, const struct curse *c, int self); extern struct message * cinfo_unit(const void * obj, typ_t typ, const struct curse *c, int self);
extern void register_unitcurse(void); extern void register_unitcurse(void);

View File

@ -39,6 +39,96 @@
<text locale="de">"$unit($mage) beschwört einen Schleier der Verwirrung."</text> <text locale="de">"$unit($mage) beschwört einen Schleier der Verwirrung."</text>
<text locale="en">"$unit($mage) summons a fog of confusion."</text> <text locale="en">"$unit($mage) summons a fog of confusion."</text>
</message> </message>
<message name="curseinfo::calm_1" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="faction" type="faction"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"$unit($unit) mag $faction($faction) zu mögen. ($int36($id))"</text>
<text locale="en">"$unit($unit) likes $faction($faction). ($int36($id))"</text>
</message>
<message name="curseinfo::calm_0" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="race" type="race"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"$unit($unit) scheint $race($race, 0) zu mögen. ($int36($id))"</text>
<text locale="en">"$unit($unit) seems to like $race($race, 0). ($int36($id))"</text>
</message>
<message name="curseinfo::skill_1" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="skill" type="skill"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"$unit($unit) ist ungewöhnlich geschickt in $skill($skill). ($int36($id))"</text>
<text locale="en">"$unit($unit) is incredibly skilled at $skill($skill). ($int36($id))"</text>
</message>
<message name="curseinfo::slave_1" section="events">
<type>
<arg name="unit" type="unit"/>
<arg name="duration" type="int"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"$unit($unit) wird noch $int($duration) $if($eq($duration,1), "Woche", "Wochen") unter unserem Bann stehen. ($int36($id))"</text>
<text locale="en">"$unit($unit) will be under our influence for $int($duration) more $if($eq($duration,1), "week", "weeks"). ($int36($id))"</text>
</message>
<message name="curseinfo::speed_1" section="events">
<type>
<arg name="number" type="int"/>
<arg name="unit" type="unit"/>
<arg name="duration" type="int"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"$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))"</text>
<text locale="en">"$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))"</text>
</message>
<message name="curseinfo::warmth_1" section="events">
<type>
<arg name="number" type="int"/>
<arg name="unit" type="unit"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"$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))"</text>
<text locale="en">"$int($number) $if($eq($number,1), "member", "members") of $unit($unit) $if($eq($number,1), "is", "are") protected from the cold. ($int36($id))"</text>
</message>
<message name="curseinfo::info_str" section="events">
<type>
<arg name="info" type="string"/>
<arg name="id" type="int"/>
</type>
<text locale="de">"${info}. ($int36($id))"</text>
</message>
<message name="curseinfo::ship_unknown" section="events">
<type>
<arg name="id" type="int"/>
</type>
<text locale="de">"Ein unbekannter Zauber liegt auf dem Schiff. ($int36($id))"</text>
<text locale="en">"An unknown spell lies on this ship. ($int36($id))"</text>
</message>
<message name="curseinfo::unit_unknown" section="events">
<type>
<arg name="id" type="int"/>
</type>
<text locale="de">"Ein unbekannter Zauber liegt auf der Einheit. ($int36($id))"</text>
<text locale="en">"An unknown spell lies on this unit. ($int36($id))"</text>
</message>
<message name="curseinfo::building_unknown" section="events">
<type>
<arg name="id" type="int"/>
</type>
<text locale="de">"Ein unbekannter Zauber liegt auf dem Gebäude. ($int36($id))"</text>
<text locale="en">"An unknown spell lies on this building. ($int36($id))"</text>
</message>
<message name="curseinfo::region_unknown" section="events">
<type>
<arg name="id" type="int"/>
</type>
<text locale="de">"Ein unbekannter Zauber liegt auf der Region. ($int36($id))"</text>
<text locale="en">"An unknown spell lies on this region. ($int36($id))"</text>
</message>
<message name="curseinfo::riotzone" section="events"> <message name="curseinfo::riotzone" section="events">
<type> <type>
<arg name="id" type="int"/> <arg name="id" type="int"/>
@ -52,7 +142,6 @@
<arg name="id" type="int"/> <arg name="id" type="int"/>
</type> </type>
<text locale="de">"Die Leute strotzen nur so vor Kraft. ($int36($id))"</text> <text locale="de">"Die Leute strotzen nur so vor Kraft. ($int36($id))"</text>
<text locale="fr">"Testosterone levels are at an all-time high. ($int36($id))"</text>
<text locale="en">"Testosterone levels are at an all-time high. ($int36($id))"</text> <text locale="en">"Testosterone levels are at an all-time high. ($int36($id))"</text>
</message> </message>
<message name="curseinfo::worse" section="events"> <message name="curseinfo::worse" section="events">
@ -61,7 +150,6 @@
<arg name="id" type="int"/> <arg name="id" type="int"/>
</type> </type>
<text locale="de">"$unit($unit) wird von einem Alp geritten. ($int36($id))"</text> <text locale="de">"$unit($unit) wird von einem Alp geritten. ($int36($id))"</text>
<text locale="fr">"$unit($unit) is chased by a nightmare. ($int36($id))"</text>
<text locale="en">"$unit($unit) is chased by a nightmare. ($int36($id))"</text> <text locale="en">"$unit($unit) is chased by a nightmare. ($int36($id))"</text>
</message> </message>
<message name="curseinfo::orcish" section="events"> <message name="curseinfo::orcish" section="events">