… | |
… | |
50 | static void build_stringlist (const char *str, char ***result_list, size_t * result_size); |
50 | static void build_stringlist (const char *str, char ***result_list, size_t * result_size); |
51 | |
51 | |
52 | static recipelist *formulalist; |
52 | static recipelist *formulalist; |
53 | |
53 | |
54 | static recipelist * |
54 | static recipelist * |
55 | init_recipelist (void) |
55 | init_recipelist () |
56 | { |
56 | { |
57 | recipelist *tl = new recipelist; |
57 | recipelist *tl = new recipelist; |
58 | |
58 | |
59 | tl->total_chance = 0; |
59 | tl->total_chance = 0; |
60 | tl->number = 0; |
60 | tl->number = 0; |
… | |
… | |
63 | |
63 | |
64 | return tl; |
64 | return tl; |
65 | } |
65 | } |
66 | |
66 | |
67 | static recipe * |
67 | static recipe * |
68 | get_empty_formula (void) |
68 | get_empty_formula () |
69 | { |
69 | { |
70 | recipe *t = new recipe; |
70 | recipe *t = new recipe; |
71 | |
71 | |
72 | t->chance = 0; |
72 | t->chance = 0; |
73 | t->index = 0; |
73 | t->index = 0; |
… | |
… | |
139 | * code, it is possible to have multiples of ingredients in a cauldron |
139 | * code, it is possible to have multiples of ingredients in a cauldron |
140 | * which could result in an index formula mismatch. We *don't* check for |
140 | * which could result in an index formula mismatch. We *don't* check for |
141 | * that possibility here. -b.t. |
141 | * that possibility here. -b.t. |
142 | */ |
142 | */ |
143 | static void |
143 | static void |
144 | check_formulae (void) |
144 | check_formulae () |
145 | { |
145 | { |
146 | recipelist *fl; |
146 | recipelist *fl; |
147 | recipe *check, *formula; |
147 | recipe *check, *formula; |
148 | int numb = 1; |
148 | int numb = 1; |
149 | |
149 | |
… | |
… | |
169 | /* |
169 | /* |
170 | * init_formulae() - Builds up the lists of formula from the file in |
170 | * init_formulae() - Builds up the lists of formula from the file in |
171 | * the libdir. -b.t. |
171 | * the libdir. -b.t. |
172 | */ |
172 | */ |
173 | void |
173 | void |
174 | init_formulae (void) |
174 | init_formulae () |
175 | { |
175 | { |
176 | static int has_been_done = 0; |
176 | static int has_been_done = 0; |
177 | FILE *fp; |
177 | FILE *fp; |
178 | char filename[MAX_BUF], buf[MAX_BUF], *cp, *next; |
178 | char filename[MAX_BUF], buf[MAX_BUF], *cp, *next; |
179 | recipe *formula = NULL; |
179 | recipe *formula = NULL; |
… | |
… | |
379 | |
379 | |
380 | return 0; |
380 | return 0; |
381 | } |
381 | } |
382 | |
382 | |
383 | static recipelist * |
383 | static recipelist * |
384 | get_random_recipelist (void) |
384 | get_random_recipelist () |
385 | { |
385 | { |
386 | recipelist *fl = NULL; |
386 | recipelist *fl = NULL; |
387 | int number = 0, roll = 0; |
387 | int number = 0, roll = 0; |
388 | |
388 | |
389 | /* first, determine # of recipelist we have */ |
389 | /* first, determine # of recipelist we have */ |