omailcmd (trunk only)

The revised newmail() wouldn't compile (Strncpy doesn't exist, `buf'
was an array of pointers rather than of char).  Simplify it substantially,
and adjust the one caller (vms) that relied on the old convoluted bit.
This commit is contained in:
nethack.rankin
2006-04-15 02:14:36 +00:00
parent b76a0fe091
commit 5501922aa8
4 changed files with 31 additions and 47 deletions

View File

@@ -379,25 +379,15 @@ struct mail_info *info;
if (info->message_typ) {
struct obj *obj = mksobj(SCR_MAIL, FALSE, FALSE);
if (info->object_nam)
obj = oname(obj, info->object_nam);
if (info->response_cmd)
new_omailcmd(obj, info->response_cmd);
if (distu(md->mx,md->my) > 2)
verbalize("Catch!");
display_nhwindow(WIN_MESSAGE, FALSE);
if (info->object_nam) {
char *buf[BUFSZ];
Strncpy(buf, info->object_nam, BUFSZ - 1);
buf[BUFSZ - 1] = '\0';
if (info->response_cmd) { /*(hide extension of the obj name)*/
int namelth = info->response_cmd - info->object_nam - 1;
if ( namelth <= 0 )
impossible("mail delivery screwed up");
else {
*(buf + namelth) = '\0';
obj = oname(obj, buf);
new_omailcmd(obj, info->response_cmd);
}
/* Note: renaming object won't discard the hidden cmd anymore. */
}
}
obj = hold_another_object(obj, "Oops!",
(const char *)0, (const char *)0);
}