Difference for common/utils.c from version 1.12 to 1.13


version 1.12 version 1.13
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_utils_c =   * static char *rcsid_utils_c =
  *   "$Id: utils.c,v 1.12 2003/11/10 05:39:50 mwedel Exp $";   *   "$Id: utils.c,v 1.13 2004/09/19 16:17:48 akirschbaum Exp $";
  */   */
   
 /*  /*
Line 50
 
Line 50
  */   */
   
 int random_roll(int min, int max, object *op, int goodbad) {  int random_roll(int min, int max, object *op, int goodbad) {
     int omin, diff, luck, base;      int omin, diff, luck, base, ran;
   
     omin = min;      omin = min;
     diff = max - min + 1;      diff = max - min + 1;
Line 61
 
Line 61
       return(min); /* avoids a float exception */        return(min); /* avoids a float exception */
     }      }
   
       ran = RANDOM();
   
     if (op->type != PLAYER)      if (op->type != PLAYER)
  return((RANDOM()%diff)+min);   return((ran%diff)+min);
   
     luck = op->stats.luck;      luck = op->stats.luck;
     if (RANDOM()%base < MIN(10, abs(luck))) {      if (RANDOM()%base < MIN(10, abs(luck))) {
Line 73
 
Line 75
      return(omin); /*check again*/       return(omin); /*check again*/
  ((goodbad) ? (min += luck) : (diff));   ((goodbad) ? (min += luck) : (diff));
   
  return(MAX(omin, MIN(max, (RANDOM()%diff)+min)));   return(MAX(omin, MIN(max, (ran%diff)+min)));
     }      }
     return((RANDOM()%diff)+min);      return((ran%diff)+min);
 }  }
   
 /*  /*
Line 129
 
Line 131
  */   */
   
 int die_roll(int num, int size, object *op, int goodbad) {  int die_roll(int num, int size, object *op, int goodbad) {
     int min, diff, luck, total, i, gotlucky, base;      int min, diff, luck, total, i, gotlucky, base, ran;
   
     diff = size;      diff = size;
     min = 1;      min = 1;
Line 152
 
Line 154
      if (diff < 1)       if (diff < 1)
  return(num); /*check again*/   return(num); /*check again*/
      ((goodbad) ? (min += luck) : (diff));       ((goodbad) ? (min += luck) : (diff));
      total += MAX(1, MIN(size, (RANDOM()%diff)+min));       ran = RANDOM();
        total += MAX(1, MIN(size, (ran%diff)+min));
  } else {   } else {
      total += RANDOM()%size+1;       total += RANDOM()%size+1;
  }   }


Legend:
line(s) removed in v.1.12 
line(s) changed
 line(s) added in v.1.13

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:19