Fixes for degenerate RNG

Assume a degenerate RNG that always returns the same number.
With these fixes, the game starts and is almost playable.
There are still some places that will go into infinite loop, eg.
the mines level generation.
This commit is contained in:
Pasi Kallinen
2020-01-06 11:48:16 +02:00
parent bfa0f072f7
commit f83dede8e5
4 changed files with 22 additions and 4 deletions

View File

@@ -2028,9 +2028,19 @@ role_init()
/* Fix up the god names */
if (flags.pantheon == -1) { /* new game */
int trycnt = 0;
flags.pantheon = flags.initrole; /* use own gods */
while (!roles[flags.pantheon].lgod) /* unless they're missing */
/* unless they're missing */
while (!roles[flags.pantheon].lgod && ++trycnt < 100)
flags.pantheon = randrole(FALSE);
if (!roles[flags.pantheon].lgod) {
int i;
for (i = 0; i < SIZE(roles) - 1; i++)
if (roles[i].lgod) {
flags.pantheon = i;
break;
}
}
}
if (!g.urole.lgod) {
g.urole.lgod = roles[flags.pantheon].lgod;