There is probably no good way to do this in a CR: writing out a list of missing objects in a message object.

This commit is contained in:
Enno Rehling 2006-01-13 22:30:24 +00:00
parent e19a918291
commit ba0851da7a
1 changed files with 21 additions and 2 deletions

View File

@ -387,7 +387,7 @@ cr_order(variant var, char * buffer, const void * userdata)
char * wp = buffer;
char * cmd = getcommand(ord);
const char * rp = cmd;
*wp++ = '\"';
while (*rp) {
switch (*rp) {
@ -400,13 +400,31 @@ cr_order(variant var, char * buffer, const void * userdata)
}
*wp++ = '\"';
*wp++ = 0;
free(cmd);
}
else strcpy(buffer, "\"\"");
return 0;
}
static int
cr_resources(variant var, char * buffer, const void * userdata)
{
resource * rlist = (resource*)var.v;
char * wp = buffer;
if (rlist!=NULL) {
wp += sprintf(wp, "%d %s", rlist->number,
resourcename(rlist->type, rlist->number!=1));
for (;;) {
rlist = rlist->next;
if (rlist==NULL) break;
wp += sprintf(wp, ", %d %s", rlist->number,
resourcename(rlist->type, rlist->number!=1));
}
}
return 0;
}
static int
cr_spell(variant var, char * buffer, const void * userdata)
{
@ -1483,6 +1501,7 @@ creport_init(void)
tsf_register("race", &cr_race);
tsf_register("direction", &cr_int);
tsf_register("alliance", &cr_alliance);
tsf_register("resources", &cr_resources);
register_reporttype("cr", &report_computer, 1<<O_COMPUTER);
}