Merge branch 'NetHack-3.6.2'

This commit is contained in:
nhmall
2019-01-29 07:27:56 -05:00
50 changed files with 778 additions and 205 deletions

View File

@@ -114,12 +114,12 @@ boolean exclude_cookie;
case 2: /*(might let a bogus input arg sneak thru)*/
case 1:
beginning = (long) g.true_rumor_start;
tidbit = Rand() % g.true_rumor_size;
tidbit = rn2(g.true_rumor_size);
break;
case 0: /* once here, 0 => false rather than "either"*/
case -1:
beginning = (long) g.false_rumor_start;
tidbit = Rand() % g.false_rumor_size;
tidbit = rn2(g.false_rumor_size);
break;
default:
impossible("strange truth value for rumor");
@@ -269,11 +269,13 @@ rumor_check()
}
}
/* Gets a random line of text from file 'fname', and returns it. */
/* Gets a random line of text from file 'fname', and returns it.
rng is the random number generator to use, and should act like rn2 does. */
char *
get_rnd_text(fname, buf)
get_rnd_text(fname, buf, rng)
const char *fname;
char *buf;
int FDECL((*rng), (int));
{
dlb *fh;
@@ -294,7 +296,7 @@ char *buf;
(void) dlb_fseek(fh, 0L, SEEK_END);
endtxt = dlb_ftell(fh);
sizetxt = endtxt - starttxt;
tidbit = Rand() % sizetxt;
tidbit = rng(sizetxt);
(void) dlb_fseek(fh, starttxt + tidbit, SEEK_SET);
(void) dlb_fgets(line, sizeof line, fh);