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

@@ -979,6 +979,7 @@ register struct trobj *trop;
if (otyp != UNDEF_TYP) {
obj = mksobj(otyp, TRUE, FALSE);
} else { /* UNDEF_TYP */
int trycnt = 0;
/*
* For random objects, do not create certain overly powerful
* items: wand of wishing, ring of levitation, or the
@@ -1019,6 +1020,8 @@ register struct trobj *trop;
dealloc_obj(obj);
obj = mkobj(trop->trclass, FALSE);
otyp = obj->otyp;
if (++trycnt > 1000)
break;
}
/* Don't start with +0 or negative rings */