numberrangeinrdparse.c
snippets · 1.8 KB · 2010-03-30
Number range in rd_parse for magic.c (dice expression parsing change).
Download « Back to the snippets list
in magic.c in the rd_parse function
find
case '*':
case '/':
case '%':
case 'd':
case 'D':
case '<':
case '>':
case '{':
case '}':
case '=':
if( !total )
gop = x;
break;
make it like this
case '*':
case '/':
case '%':
case 'd':
case 'D':
case 'R':
case '<':
case '>':
case '{':
case '}':
case '=':
if( !total )
gop = x;
break;
Thats just adding in the 'r' and 'R' cases
Then farther down find
case 'd':
case 'D':
total = dice( total, rd_parse( ch, level, sexp[1] ) );
break;
case '<':
total = ( total < rd_parse( ch, level, sexp[1] ) );
break;
make it like this
case 'd':
case 'D':
total = dice( total, rd_parse( ch, level, sexp[1] ) );
break;
case 'R':
total = number_range( total, rd_parse( ch, level, sexp[1] ) );
break;
case '<':
total = ( total < rd_parse( ch, level, sexp[1] ) );
break;
Thats adding in the handling of them :)
Thats all there is to that one and it's actually a nice little deal :) Just have to make sure that its used correctly
(10*5)R(12*7) returned 70 from dice_parse
and that one would always return 70 while doing this
((10*5)R(12*7)) returned <random number between 50 and 84> from dice_parse
Hope someone finds it useful even though its a simple deal later.
*Update* Removed the 'r' cases since they have been found to be able to cause like sanctuary (in the modified field and scry etc...) to return wierd values instead of the 0 they should return so you get the right affects :)