version 1.2 | | version 1.3 |
---|
| | |
/* looks like we have to choose a random one */ | | /* looks like we have to choose a random one */ |
if(fl==NULL) if((fl=get_random_recipelist())==NULL) return rp; | | if(fl==NULL) if((fl=get_random_recipelist())==NULL) return rp; |
| | |
| | if (fl->total_chance > 0) { |
r=RANDOM()%fl->total_chance; | | r=RANDOM()%fl->total_chance; |
| | printf(" r = %d\n", r); |
for (rp=fl->items;rp;rp=rp->next) { | | for (rp=fl->items;rp;rp=rp->next) { |
r -= rp->chance; | | r -= rp->chance; |
if (r<0) break; | | if (r<0) break; |
} | | } |
| | } |
return rp; | | return rp; |
} | | } |
| | |