X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=misc.c;h=5e7692149ed88697579374b023cd6facb21f05ae;hb=7eaefce61d74fbc73daabd3f42f048038366b5ad;hp=ac22ae039dde7a15f739a6d9c67ff9be60eee518;hpb=e66b4561d457352d76582828fbfa3bd83d8b8a4c;p=open-adventure.git diff --git a/misc.c b/misc.c index ac22ae0..5e76921 100644 --- a/misc.c +++ b/misc.c @@ -187,7 +187,7 @@ void vspeak(const char* msg, va_list ap) } else { long arg = va_arg(ap, long); if (arg == -1) - arg = 0; + arg = 0; // LCOV_EXCL_LINE - don't think we can get here. i++; // Integer specifier. In order to accommodate the fact // that PARMS can have both legitimate integers *and* @@ -325,7 +325,7 @@ char* get_input() { // Set up the prompt char input_prompt[] = "> "; - if (!prompt) + if (!settings.prompt) input_prompt[0] = '\0'; // Print a blank line if game.blklin tells us to. @@ -353,8 +353,8 @@ char* get_input() if (!isatty(0)) echo_input(stdout, input_prompt, input); - if (logfp) - echo_input(logfp, "", input); + if (settings.logfp) + echo_input(settings.logfp, "", input); return (input); } @@ -459,7 +459,7 @@ int get_motion_vocab_id(const char* word) { for (int i = 0; i < NMOTIONS; ++i) { for (int j = 0; j < motions[i].words.n; ++j) { - if (strcasecmp(word, motions[i].words.strs[j]) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !oldstyle)) + if (strcasecmp(word, motions[i].words.strs[j]) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !settings.oldstyle)) return (i); } } @@ -485,7 +485,7 @@ int get_action_vocab_id(const char* word) { for (int i = 0; i < NACTIONS; ++i) { for (int j = 0; j < actions[i].words.n; ++j) { - if (strcasecmp(word, actions[i].words.strs[j]) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !oldstyle)) + if (strcasecmp(word, actions[i].words.strs[j]) == 0 && (strlen(word) > 1 || strchr(ignore, word[0]) == NULL || !settings.oldstyle)) return (i); } } @@ -633,8 +633,8 @@ long atdwrf(long where) return (at); } -/* Utility routines (SETBIT, TSTBIT, set_seed, get_next_lcg_value, - * randrange, RNDVOC) */ +/* Utility routines (setbit, tstbit, set_seed, get_next_lcg_value, + * randrange) */ long setbit(long bit) /* Returns 2**bit for use in constructing bit-masks. */ @@ -652,6 +652,9 @@ void set_seed(long seedval) /* Set the LCG seed */ { game.lcg_x = (unsigned long) seedval % game.lcg_m; + + // once seed is set, we need to generate the Z`ZZZ word + make_zzword(game.zzword); } unsigned long get_next_lcg_value(void) @@ -677,14 +680,6 @@ void make_zzword(char zzword[6]) zzword[5] = '\0'; } -void datime(long* d, long* t) -{ - struct timeval tv; - gettimeofday(&tv, NULL); - *d = (long) tv.tv_sec; - *t = (long) tv.tv_usec; -} - // LCOV_EXCL_START void bug(enum bugtype num, const char *error_string) {