X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=be6ec81bb49c6595fb176d098f957660223d750d;hb=6150e3be1fdc8d55ff79f87c014a62a134559799;hp=81f8e2b2bd4f0212d258495fb0bed42403a7501b;hpb=6521d49c0752da0bf65769a1d38b583d3a2a1854;p=open-adventure.git diff --git a/misc.c b/misc.c index 81f8e2b..be6ec81 100644 --- a/misc.c +++ b/misc.c @@ -166,7 +166,7 @@ void pspeak(vocab_t msg, enum speaktype mode, int skip, ...) vspeak(objects[msg].inventory, ap); break; case look: - vspeak(objects[msg].longs[skip], ap); + vspeak(objects[msg].descriptions[skip], ap); break; case hear: vspeak(objects[msg].sounds[skip], ap); @@ -174,6 +174,9 @@ void pspeak(vocab_t msg, enum speaktype mode, int skip, ...) case study: vspeak(objects[msg].texts[skip], ap); break; + case change: + vspeak(objects[msg].changes[skip], ap); + break; } va_end(ap); } @@ -252,7 +255,10 @@ char* get_input() input = NULL; size_t n = 0; if (isatty(0)) + // LCOV_EXCL_START + // Should be unreachable in tests, as they will use a non-interactive shell. printf("%s", input_prompt); + // LCOV_EXCL_STOP IGNORE(getline(&input, &n, stdin)); } @@ -289,10 +295,13 @@ bool yes(const char* question, const char* yes_response, const char* no_response speak(question); reply = get_input(); - if (reply == NULL) { - linenoiseFree(reply); - exit(EXIT_SUCCESS); - } + if (reply == NULL) { + // LCOV_EXCL_START + // Should be unreachable. Reply should never be NULL + linenoiseFree(reply); + exit(EXIT_SUCCESS); + // LCOV_EXCL_STOP + } char* firstword = (char*) xmalloc(strlen(reply)+1); sscanf(reply, "%s", firstword); @@ -529,7 +538,7 @@ long atdwrf(long where) long setbit(long bit) /* Returns 2**bit for use in constructing bit-masks. */ { - return (1 << bit); + return (1L << bit); } bool tstbit(long mask, int bit)