receiver in messages wieder rueckgaengig

This commit is contained in:
Enno Rehling 2001-05-20 10:42:15 +00:00
parent ba59e334a8
commit df4efb853a
3 changed files with 8 additions and 10 deletions

View File

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

View File

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

View File

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