forked from github/server
- All the cinfo_* functions will now return a message * object, which is nicer than using buf[].
- Some English translation.
This commit is contained in:
parent
da224f6670
commit
1030e44c07
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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))))
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 *
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -33,26 +33,19 @@
|
|||
#include <assert.h>
|
||||
|
||||
|
||||
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 */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
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 = {
|
||||
|
@ -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 = {
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
#include <assert.h>
|
||||
|
||||
|
||||
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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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(")");
|
||||
|
||||
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 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 = {
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -39,6 +39,96 @@
|
|||
<text locale="de">"$unit($mage) beschwört einen Schleier der Verwirrung."</text>
|
||||
<text locale="en">"$unit($mage) summons a fog of confusion."</text>
|
||||
</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">
|
||||
<type>
|
||||
<arg name="id" type="int"/>
|
||||
|
@ -52,7 +142,6 @@
|
|||
<arg name="id" type="int"/>
|
||||
</type>
|
||||
<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>
|
||||
</message>
|
||||
<message name="curseinfo::worse" section="events">
|
||||
|
@ -61,7 +150,6 @@
|
|||
<arg name="id" type="int"/>
|
||||
</type>
|
||||
<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>
|
||||
</message>
|
||||
<message name="curseinfo::orcish" section="events">
|
||||
|
|
Loading…
Reference in New Issue