From 727e6194c866bb32f0ef991f77de4acad14a3ae9 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 1 Jul 2011 19:05:16 +0200 Subject: [PATCH] Update and report status even after empty command When getcommand() reads an empty string, it prints another prompt and reads another line, without running status(). That's bad: * nat_timeused is not updated. Affects the player's prompt, deities' nat selector timeused, and commands edit, players, xdump nat. * Mortal player isn't logged off for game hours, game down, and time limit. * Notifications are delayed: going broke, becoming solvent, new telegrams (toggle inform off only), new announcements, capital lost. Fix by removing the loop. Callers handle empty input just fine since 4.2.2. Side effect: empty commands are now recorded in player_commands[]. That's okay. --- src/lib/player/empdis.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/lib/player/empdis.c b/src/lib/player/empdis.c index 7c886b38..94e9c7d8 100644 --- a/src/lib/player/empdis.c +++ b/src/lib/player/empdis.c @@ -77,13 +77,9 @@ getcommand(char *combufp) sprintf(player_commands[player_commands_index], "%3d %3d [prompt]", player_commands_index, player->cnum); - do { - prprompt(natp->nat_timeused / 60, natp->nat_btu); - buf[0] = 0; - if (recvclient(buf, sizeof(buf)) < 0) { - return -1; - } - } while (buf[0] == 0); + prprompt(natp->nat_timeused / 60, natp->nat_btu); + if (recvclient(buf, sizeof(buf)) < 0) + return -1; if (++player_commands_index >= KEEP_COMMANDS) player_commands_index = 0;