Change wire not to read more after confirming deletion

Telegram deletion deletes the mailbox.  If more telegrams arrive while
we wait for the player to confirm deletion, the mailbox again contains
unread telegrams, so we can't just delete it.  Instead, rea() loops to
read the new telegrams.

Announcements worked the same until Empire 3 put them in a single file
shared by all.  Since then, deleting announcements merely updates
nat_annotim, and there's no need to read new announcements after
getting the player's confirmation.  So don't.
This commit is contained in:
Markus Armbruster 2011-11-23 07:34:19 +01:00
parent 5acdcfec63
commit 43f562145e

View file

@ -157,19 +157,19 @@ rea(void)
} }
p = getstarg(player->argp[1], p, buf); p = getstarg(player->argp[1], p, buf);
if (p && *p == 'y') { if (p && *p == 'y') {
if ((filelen = fsize(fileno(telfp))) > size) {
pr("Wait a sec! A new %s has arrived...\n", kind);
/* force stdio to re-read tel file */
(void)fflush(telfp);
(void)fseek(telfp, (long)size, SEEK_SET);
size = filelen;
now = time(NULL);
goto more;
}
if (*kind == 'a') { if (*kind == 'a') {
np->nat_annotim = now; np->nat_annotim = now;
putnat(np); putnat(np);
} else { } else {
if ((filelen = fsize(fileno(telfp))) > size) {
pr("Wait a sec! A new %s has arrived...\n", kind);
/* force stdio to re-read tel file */
(void)fflush(telfp);
(void)fseek(telfp, (long)size, SEEK_SET);
size = filelen;
now = time(NULL);
goto more;
}
/* Here, we just re-open the file for "w" only, /* Here, we just re-open the file for "w" only,
and that will wipe the file clean automatically */ and that will wipe the file clean automatically */
(void)fclose(telfp); (void)fclose(telfp);