Don't advance the main RNG during hallucination

This is based on the multiple-RNGs code fron NetHack4, but using
only the parts relevant to the display RNG (and with substantial
changes, both because of post-3.4.3 changes, and because Nethack4's
display code is based on Slash'EM's rather than NetHack's).
This commit is contained in:
Alex Smith
2019-01-28 04:45:26 +00:00
parent 1083971228
commit ce5184c3da
21 changed files with 150 additions and 93 deletions

View File

@@ -2095,13 +2095,18 @@ aligntyp alignment;
if (!Hallucination)
return align_gname(alignment);
/* Count the roles, so that we can pick one at random. */
int rolecount = 0;
while (roles[rolecount].filecode)
rolecount++;
/* The priest may not have initialized god names. If this is the
* case, and we roll priest, we need to try again. */
case, and we roll priest, we need to try again. */
do
which = randrole();
which = rn2_on_display_rng(rolecount);
while (!roles[which].lgod);
switch (rn2(9)) {
switch (rn2_on_display_rng(9)) {
case 0:
case 1:
gnam = roles[which].lgod;
@@ -2116,7 +2121,7 @@ aligntyp alignment;
break;
case 6:
case 7:
gnam = hallu_gods[rn2(sizeof hallu_gods / sizeof *hallu_gods)];
gnam = hallu_gods[rn2_on_display_rng(SIZE(hallu_gods))];
break;
case 8:
gnam = Moloch;