From: Markus Armbruster Date: Wed, 23 Nov 2011 06:34:19 +0000 (+0100) Subject: Change wire not to read more after confirming deletion X-Git-Tag: v4.3.29~9 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=43f562145eab56e12255b8b53b11f365591a9000 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. --- diff --git a/src/lib/commands/rea.c b/src/lib/commands/rea.c index 33fcde34c..28f787274 100644 --- a/src/lib/commands/rea.c +++ b/src/lib/commands/rea.c @@ -157,19 +157,19 @@ rea(void) } p = getstarg(player->argp[1], p, buf); 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') { np->nat_annotim = now; putnat(np); } 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, and that will wipe the file clean automatically */ (void)fclose(telfp);