I had installed a fix to makemon() to better balance monsters when
using KOPS and ROCKMOLE. Here's what the code looked like:
} else {
ct = CMNUM - strlen(fut_geno);
if(index(fut_geno, 'm')) ct++; /* make only 1 minotaur */
if(index(fut_geno, '@')) ct++;
if(ct <= 0) return(0); /* no more monsters! */
tmp = 7;
#ifdef KOPS
tmp--;
#endif KOPS
#ifdef ROCKMOLE
if(dlevel<4)tmp--;
#endif ROCKMOLE
tmp = rn2(ct*dlevel/24 + tmp);
if(tmp < dlevel - 4) tmp = rn2(ct*dlevel/24 + 12);
if(tmp >= ct) tmp = rn1(ct - ct/2, ct/2);
ct = 0;
#ifdef KOPS
ct++; /****************************/
#endif KOPS
for(; ct < CMNUM; ct++){
ptr = &mons[ct];
if(index(fut_geno, ptr->mlet))
continue;
if(!tmp--) goto gotmon;
}
panic("makemon?");
}
gotmon:
The problem is when ct is decremented when KOPS is on (see ***);
tmp needs to be correspondingly (if it is greater than 0).
Specifically, that portion of the code should look like this
tmp = rn2(ct*dlevel/24 + tmp);
if(tmp < dlevel - 4) tmp = rn2(ct*dlevel/24 + 12);
if(tmp >= ct) tmp = rn1(ct - ct/2, ct/2);
ct = 0;
#ifdef KOPS
ct++; tmp = (tmp) ? tmp-- : tmp;
#endif KOPS
for(; ct < CMNUM; ct++){
ptr = &mons[ct];
Now you can be assured that the loop will terminate correctly and
that there will be no panic.
- Gil