X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=23c053f2e41a7b91f41e1ebda1b154361e6629c9;hb=0d3393ebee2cfa97cd7b51daf0448992df758594;hp=2fe1363826eef89a4b85a76c0667a210cb6d936e;hpb=5337e00725f17e08836fb2a2f59ab178ece47000;p=open-adventure.git diff --git a/misc.c b/misc.c index 2fe1363..23c053f 100644 --- a/misc.c +++ b/misc.c @@ -93,6 +93,7 @@ static void vspeak(const char* msg, bool blank, va_list ap) } } + // LCOV_EXCL_START - doesn't occur in test suite. /* Version specifier */ if (msg[i] == 'V') { strcpy(renderp, VERSION); @@ -100,6 +101,7 @@ static void vspeak(const char* msg, bool blank, va_list ap) renderp += len; size -= len; } + // LCOV_EXCL_STOP } } *renderp = 0; @@ -386,19 +388,6 @@ static int get_action_vocab_id(const char* word) return (WORD_NOT_FOUND); } -static int get_special_vocab_id(const char* word) -// Return the first special number that has 'word' as one of its words. -{ - for (int i = 0; i < NSPECIALS; ++i) { - for (int j = 0; j < specials[i].words.n; ++j) { - if (strncasecmp(word, specials[i].words.strs[j], TOKLEN) == 0) - return (i); - } - } - // If execution reaches here, we didn't find the word. - return (WORD_NOT_FOUND); -} - static bool is_valid_int(const char *str) /* Returns true if the string passed in is represents a valid integer, * that could then be parsed by atoi() */ @@ -407,9 +396,10 @@ static bool is_valid_int(const char *str) if (*str == '-') ++str; - // Handle empty string or just "-" + // Handle empty string or just "-". Should never reach this + // point, because this is only used with transitive verbs. if (!*str) - return false; + return false; // LCOV_EXCL_LINE // Check for non-digit chars in the rest of the stirng. while (*str) @@ -423,7 +413,7 @@ static bool is_valid_int(const char *str) return true; } -static void get_vocab_metadata(const char* word, vocab_t* id, enum wordtype* type) +static void get_vocab_metadata(const char* word, vocab_t* id, word_type_t* type) { /* Check for an empty string */ if (strncmp(word, "", sizeof("")) == 0) { @@ -455,13 +445,6 @@ static void get_vocab_metadata(const char* word, vocab_t* id, enum wordtype* typ return; } - ref_num = get_special_vocab_id(word); - if (ref_num != WORD_NOT_FOUND) { - *id = ref_num; - *type = SPECIAL; - return; - } - // Check for the reservoir magic word. if (strcasecmp(word, game.zzword) == 0) { *id = PART; @@ -673,7 +656,7 @@ void set_seed(long seedval) game.zzword[5] = '\0'; } -unsigned long get_next_lcg_value(void) +static unsigned long get_next_lcg_value(void) /* Return the LCG's current value, and then iterate it. */ { unsigned long old_x = game.lcg_x;