From: Pasi Kallinen Date: Sat, 30 Apr 2016 19:41:41 +0000 (+0300) Subject: Fix wish text matcher not allowing probability 0 objects X-Git-Tag: NetHack-3.6.1_RC01~800 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89dd37f8c75ca08e3905e125352709471b15e1d3;p=nethack Fix wish text matcher not allowing probability 0 objects --- diff --git a/src/objnam.c b/src/objnam.c index d5e1f4b80..e6f3569d5 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -2477,7 +2477,7 @@ char oclass; } if (otyp != STRANGE_OBJECT) { validobjs[n++] = otyp; - maxprob += objects[otyp].oc_prob; + maxprob += (objects[otyp].oc_prob + 1); otyp = STRANGE_OBJECT; } i++; @@ -2486,7 +2486,7 @@ char oclass; if (n > 0 && maxprob) { long prob = rn2(maxprob); i = 0; - while ((i < (n-1)) && (prob -= objects[validobjs[i]].oc_prob) > 0) + while ((i < (n-1)) && (prob -= (objects[validobjs[i]].oc_prob + 1)) > 0) i++; return validobjs[i]; }