--- ray/src/rt/source.c 1990/01/11 11:06:22 1.19 +++ ray/src/rt/source.c 1990/12/12 22:43:03 1.23 @@ -310,6 +310,8 @@ char *p; /* data for f */ double prob, ourthresh, hwt, test2, hit2; RAY sr; + if (nsources <= 0) + return; srccnt = (CONTRIB *)malloc(nsources*sizeof(CONTRIB)); cntord = (CNTPTR *)malloc(nsources*sizeof(CNTPTR)); if (srccnt == NULL || cntord == NULL) @@ -395,7 +397,7 @@ char *p; /* data for f */ } /* weighted hit rate */ hwt = hit2 / test2; -#ifdef notdef +#ifdef DEBUG sprintf(errmsg, "%d tested, %d untested, %f hit rate\n", sn, ncnts-sn, hwt); eputs(errmsg); @@ -408,8 +410,8 @@ char *p; /* data for f */ addcolor(r->rcol, srccnt[cntord[sn].sno].val); } - free(srccnt); - free(cntord); + free((char *)srccnt); + free((char *)cntord); } @@ -453,6 +455,8 @@ register RAY *r; m->oargs.farg[2]); /* modify value */ multcolor(r->rcol, r->pcol); + /* assign distance */ + r->rt = r->rot; } }