1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
/*
* rolldice.h - v1.7 - 28 Mar 1999
* (c) Stevie Strickland, 1999
*
* This program has been placed under the GPL. Any bugfixes or enhancements
* will be greatly appreciated :)
*
* Stevie Strickland - sstrickl@resnet.gatech.edu
*/
// Standard includes
#include <stdio.h>
#include <stdlib.h>
// For the time() function
#include <time.h>
// For the rand() and srand() functions
#include <math.h>
// For the strstr() function
#include <string.h>
// For some bounds
#include <values.h>
/* The following #defines give the position of each important dice-related
* number inside of the dice_nums array. The final #define gives us the
* size of the dice_nums array, which should be the number of other
* #defines below.
*/
#define NUM_ROLLS 0
#define NUM_DICE 1
#define NUM_SIDES 2
#define MULTIPLIER 3
#define MODIFIER 4
#define NUM_DROP 5
#define DICE_ARRAY_SIZE 6
/* The following #defines give the tokens for each part of the format
* string. Perhaps eventually I'll change parse_string to use strtok()
* instead of strstr() :)
*/
#define ROLL_IDENT "x"
#define DICE_SIDES_IDENT "d"
#define MULTI_IDENT "*"
#define MOD_PLUS_IDENT "+"
#define MOD_MINUS_IDENT "-"
#define DROP_IDENT "s"
// Defines values for true and false, just for testing stuff boolean-wise :)
#define TRUE_VAL 1
#define FALSE_VAL 0
// Defines values for the random number file to use
#define URANDOM 0
#define RANDOM 1
// External function declarations for using rolldice() and kin.
extern int *parse_string(char *dice_string);
extern int rolldie(int num_sides);
extern void init_random(int rand_file);
|