- Regionsbotschaften parteigezogen. Nicht wirklich getestet.

This commit is contained in:
Christian Schlittchen 2001-05-20 10:02:23 +00:00
parent 9e49e7ef47
commit ba59e334a8
6 changed files with 44 additions and 39 deletions

View File

@ -379,6 +379,7 @@ render_messages(FILE * F, faction * f, message_list *msgs)
{
struct mlist* m = msgs->begin;
while (m) {
if(m->msg->receiver == NULL || m->msg->receiver == f) {
char crbuffer[1024*32]; /* gross, wegen spionage-messages :-( */
boolean printed = false;
const struct message_type * mtype = m->msg->type;
@ -412,6 +413,7 @@ render_messages(FILE * F, faction * f, message_list *msgs)
mtypehash[ihash] = kmt;
}
}
}
m = m->next;
}
}

View File

@ -752,7 +752,8 @@ rp_messages(FILE * F, message_list * msgs, faction * viewer, int indent, boolean
if (!debug && get_msglevel(viewer->warnings, viewer->msglevels, m->type) < m->level) continue;
#endif
/* messagetype * mt = m->type; */
if (strcmp(nr_section(m->msg), category->name)==0)
if (strcmp(nr_section(m->msg), category->name)==0
&& (m->msg->receiver == NULL || m->msg->receiver == viewer))
{
char buf[4096], *s = buf;
nr_render(m->msg, viewer->locale, s, viewer);

View File

@ -291,7 +291,7 @@ msg_error(const struct unit * u, const char * cmd, const char * name, const char
}
va_end(marker);
return msg_create(mtype, (void**)args);
return msg_create(mtype, u->faction, (void**)args);
}
message *
@ -322,7 +322,7 @@ msg_message(const char * name, const char* sig, ...)
}
va_end(marker);
return msg_create(mtype, (void**)args);
return msg_create(mtype, NULL, (void**)args);
}
message *
@ -423,7 +423,7 @@ new_message(struct faction * receiver, const char* sig, ...)
}
}
va_end(marker);
return msg_create(mtype, (void**)args);
return msg_create(mtype, receiver, (void**)args);
}
static void

View File

@ -73,10 +73,11 @@ mt_new_va(const char * name, ...)
}
message *
msg_create(const struct message_type * type, void * args[])
msg_create(const struct message_type * type, struct faction *receiver, void * args[])
{
int i;
message * msg = (message *)malloc(sizeof(message));
msg->receiver = receiver;
msg->type = type;
msg->parameters = calloc(sizeof(void*), type->nparameters);
for (i=0;i!=type->nparameters;++i) {
@ -86,7 +87,7 @@ msg_create(const struct message_type * type, void * args[])
}
message *
msg_create_va(const struct message_type * type, ...)
msg_create_va(const struct message_type * type, struct faction *receiver, ...)
/* sets a messages parameters */
{
void * args[16];
@ -97,7 +98,7 @@ msg_create_va(const struct message_type * type, ...)
args[i] = va_arg(marker, void*);
}
va_end(marker);
return msg_create(type, args);
return msg_create(type, receiver, args);
}
typedef struct messagetype_list {

View File

@ -20,6 +20,7 @@ typedef struct message_type {
} message_type;
typedef struct message {
struct faction *receiver;
const struct message_type * type;
const void ** parameters;
} message;
@ -29,8 +30,8 @@ extern struct message_type * mt_new_va(const char * name, ...);
/* mt_new("simple_sentence", "subject:string", "predicate:string",
* "object:string", "lang:locale", NULL); */
extern struct message * msg_create(const struct message_type * type, void * args[]);
extern struct message * msg_create_va(const struct message_type * type, ...);
extern struct message * msg_create(const struct message_type * type, struct faction *receiver, void * args[]);
extern struct message * msg_create_va(const struct message_type * type, struct faction *receiver, ...);
/* msg_create(&mt_simplesentence, "enno", "eats", "chocolate", &locale_de);
* parameters must be in the same order as they were for mt_new! */
extern void msg_free(struct message *m);

View File

@ -4107,7 +4107,7 @@
</nr>
</locale>
<locale name="en">
<nr section="none">
<nr section="events">
<text>"$faction($from) donates $int($amount) silver to $faction($to)."</text>
</nr>
</locale>