From eff657014b71031aa2fecedf04d21fbac5d3e874 Mon Sep 17 00:00:00 2001 From: Chris Marsh Date: Tue, 25 Jul 2017 14:33:12 -0700 Subject: [PATCH] Add quit to test shutdown works; empty command to not send presence. --- examples/send-presence/send-presence.c | 29 +++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/send-presence/send-presence.c b/examples/send-presence/send-presence.c index a761303..17322ce 100644 --- a/examples/send-presence/send-presence.c +++ b/examples/send-presence/send-presence.c @@ -68,21 +68,26 @@ static void gameLoop() printf("You are standing in an open field west of a white house.\n"); while (prompt(line, sizeof(line))) { - if (time(NULL) & 1) { - printf("I don't understand that.\n"); - } - else { - space = strchr(line, ' '); - if (space) { - *space = 0; + if (line[0]) { + if (line[0] == 'q') { + break; } - printf("I don't know the word \"%s\".\n", line); + if (time(NULL) & 1) { + printf("I don't understand that.\n"); + } + else { + space = strchr(line, ' '); + if (space) { + *space = 0; + } + printf("I don't know the word \"%s\".\n", line); + } + + ++FrustrationLevel; + + updateDiscordPresence(); } - ++FrustrationLevel; - - updateDiscordPresence(); - #ifdef DISCORD_DISABLE_IO_THREAD Discord_UpdateConnection(); #endif