Crossfire Server, Trunk
recipe.c
Go to the documentation of this file.
1 /*
2  * Crossfire -- cooperative multi-player graphical RPG and adventure game
3  *
4  * Copyright (c) 1999-2014 Mark Wedel and the Crossfire Development Team
5  * Copyright (c) 1992 Frank Tore Johansen
6  *
7  * Crossfire is free software and comes with ABSOLUTELY NO WARRANTY. You are
8  * welcome to redistribute it under certain conditions. For details, please
9  * see COPYING and LICENSE.
10  *
11  * The authors can be reached via e-mail at <crossfire@metalforge.org>.
12  */
13 
35 #include "global.h"
36 
37 #include <assert.h>
38 #include <ctype.h>
39 #include <stdlib.h>
40 #include <string.h>
41 
42 #include "object.h"
43 #include "assets.h"
44 
45 static void build_stringlist(const char *str, char ***result_list, size_t *result_size);
46 
49 
58 static recipelist *init_recipelist(void) {
59  recipelist *tl = (recipelist *)malloc(sizeof(recipelist));
60  if (tl == NULL)
62  tl->total_chance = 0;
63  tl->number = 0;
64  tl->items = NULL;
65  tl->next = NULL;
66  return tl;
67 }
68 
77 static recipe *get_empty_formula(void) {
78  // This used to be a malloc followed by setting everything to zero.
79  // So just use calloc to make it faster.
80  // SilverNexus -- 2018-10-22
81  recipe *t = (recipe *)calloc(1, sizeof(recipe));
82  if (t == NULL)
84  return t;
85 }
86 
97  recipelist *fl = formulalist;
98  int number = i;
99 
100  while (fl && number > 1) {
101  if (!(fl = fl->next))
102  break;
103  number--;
104  }
105  return fl;
106 }
107 
118 static int check_recipe(const recipe *rp) {
119  size_t i;
120  int result;
121 
122  result = 1;
123  for (i = 0; i < rp->arch_names; i++) {
124  if (try_find_archetype(rp->arch_name[i]) != NULL) {
125  if (strcmp(rp->title, "NONE")) {
126  const artifact *art = locate_recipe_artifact(rp, i);
127 
128  if (!art) {
129  LOG(llevError, "Formula %s of %s has no artifact.\n", rp->arch_name[i], rp->title);
130  result = 0;
131  }
132  }
133  } else {
134  LOG(llevError, "Can't find archetype %s for formula %s\n", rp->arch_name[i], rp->title);
135  result = 0;
136  }
137  }
138 
139  return result;
140 }
141 
147  const recipelist *rl = formulalist;
148  int abort = 0;
149  while (rl) {
150  const recipe *rp = rl->items;
151  while (rp) {
152  if (!check_recipe(rp)) {
153  abort = 1;
154  }
155  rp = rp->next;
156  }
157  rl = rl->next;
158  }
159  if (abort) {
161  }
162 }
163 
167 void init_formulae(BufferReader *reader, const char *filename) {
168  char *buf, *cp, *next;
169  recipe *formula = NULL;
170  recipelist *fl;
171  linked_char *tmp;
172  int value;
173 
174  if (!formulalist)
176 
177  while ((buf = bufferreader_next_line(reader)) != NULL) {
178  if (*buf == '#' || *buf == '\0')
179  continue;
180  cp = buf;
181  while (*cp == ' ') /* Skip blanks */
182  cp++;
183 
184  if (!strncmp(cp, "Remove ", 7)) {
185  if (strcmp(cp + 7, "*") == 0) {
188  } else {
189  LOG(llevError, "Recipes: only '*' is accepted for 'Remove' at %s:%d\n", filename, bufferreader_current_line(reader));
190  }
191  continue;
192  }
193  if (!strncmp(cp, "Object", 6)) {
194  formula = get_empty_formula();
195  formula->title = add_string(strchr(cp, ' ')+1);
196  } else if (formula == NULL) {
197  LOG(llevError, "recipe.c: First key in formulae file %s is not \"Object\".\n", filename);
199  } else if (!strncmp(cp, "keycode", 7)) {
200  formula->keycode = add_string(strchr(cp, ' ')+1);
201  } else if (sscanf(cp, "trans %d", &value)) {
202  formula->transmute = value;
203  } else if (sscanf(cp, "yield %d", &value)) {
204  formula->yield = value;
205  } else if (sscanf(cp, "chance %d", &value)) {
206  formula->chance = value;
207  } else if (sscanf(cp, "exp %d", &value)) {
208  formula->exp = value;
209  } else if (sscanf(cp, "diff %d", &value)) {
210  formula->diff = value;
211  } else if (!strncmp(cp, "ingred", 6)) {
212  int numb_ingred;
213  formula->ingred_count = 1;
214  cp = strchr(cp, ' ')+1;
215  do {
216  if ((next = strchr(cp, ',')) != NULL) {
217  *(next++) = '\0';
218  formula->ingred_count++;
219  }
220  tmp = (linked_char *)malloc(sizeof(linked_char));
221  /* trim the string */
222  while (*cp == ' ')
223  cp++;
224  while (*cp != '\0' && cp[strlen(cp) - 1] == ' ')
225  cp[strlen(cp) - 1] = '\0';
226  tmp->name = add_string(cp);
227  tmp->next = formula->ingred;
228  formula->ingred = tmp;
229  /* each ingredient's ASCII value is coadded. Later on this
230  * value will be used allow us to search the formula lists
231  * quickly for the right recipe.
232  */
233  formula->index += strtoint(cp);
234  } while ((cp = next) != NULL);
235  /* now find the correct (# of ingred ordered) formulalist */
236  numb_ingred = formula->ingred_count;
237  fl = formulalist;
238  while (numb_ingred != 1) {
239  if (!fl->next)
240  fl->next = init_recipelist();
241  fl = fl->next;
242  numb_ingred--;
243  }
244  fl->total_chance += formula->chance;
245  fl->number++;
246  formula->next = fl->items;
247  fl->items = formula;
248  } else if (!strncmp(cp, "arch", 4)) {
249  build_stringlist(strchr(cp, ' ')+1, &formula->arch_name, &formula->arch_names);
250  } else if (!strncmp(cp, "skill", 5)) {
251  formula->skill = add_string(strchr(cp, ' ')+1);
252  } else if (!strncmp(cp, "cauldron", 8)) {
253  formula->cauldron = add_string(strchr(cp, ' ')+1);
254  } else if (!strncmp(cp, "failure_arch ", 13)) {
255  formula->failure_arch = add_string(strchr(cp, ' ')+1);
256  } else if (!strncmp(cp, "failure_message ", 16)) {
257  formula->failure_message = add_string(strchr(cp, ' ')+1);
258  } else if (sscanf(cp, "min_level %d", &value)) {
259  formula->min_level = value;
260  } else if (!strncmp(cp, "tool ", 5)) {
261  build_stringlist(strchr(cp, ' ')+1, &formula->tool, &formula->tool_size);
262  } else if (sscanf(cp, "combination %d", &value)) {
263  formula->is_combination = value ? 1 : 0;
264  } else
265  LOG(llevError, "Unknown input in file %s: %s\n", filename, buf);
266  }
267  LOG(llevDebug, "done.\n");
268 }
269 
284 void check_formulae(void) {
285  recipelist *fl;
286  recipe *check, *formula;
287  int numb = 1, tool_match;
288  size_t tool_i,tool_j;
289 
290  LOG(llevDebug, "Checking formulae lists...\n");
291 
292  for (fl = formulalist; fl != NULL; fl = fl->next) {
293  for (formula = fl->items; formula != NULL; formula = formula->next) {
294  for (check = formula->next; check != NULL; check = check->next)
295  /* If one recipe has a tool and another a caudron, we should be able to handle it */
296  if (check->index == formula->index &&
297  ((check->cauldron && formula->cauldron && strcmp(check->cauldron, formula->cauldron) == 0) ||
298  (check->tool_size == formula->tool_size && check->tool_size > 0))) {
299  /* Check the tool list to make sure they have no matches */
300  if (check->tool && formula->tool)
301  {
302  tool_match = 0;
303  for (tool_i = 0; tool_i < formula->tool_size; ++tool_i)
304  /* If it turns out these lists are sorted, then we could optimize this better. */
305  for (tool_j = 0; tool_j < check->tool_size; ++tool_j)
306  if (strcmp(formula->tool[tool_i], check->tool[tool_j]) == 0) {
307  tool_match = 1;
308  break; /* TODO: break out of the double loop */
309  }
310  }
311  else
312  tool_match = 1; /* If we get here, we matched on the cauldron */
313  /* Check to see if we have a denoted match */
314  if (tool_match) {
315  /* if the recipes don't have the same facility, then no issue anyway. */
316  LOG(llevError, " ERROR: On %d ingred list:\n", numb);
317  LOG(llevError, "Formulae [%s] of %s and [%s] of %s have matching index id (%d)\n",
318  formula->arch_name[0], formula->title, check->arch_name[0], check->title, formula->index);
319  }
320  }
321  for (size_t idx = 0; idx < formula->arch_names; idx++) {
322  if (try_find_archetype(formula->arch_name[idx]) == NULL) {
323  LOG(llevError, "Formulae %s of %s (%d ingredients) references non existent archetype %s\n",
324  formula->arch_name[0], formula->title, numb, formula->arch_name[idx]);
325  }
326  }
327  }
328  numb++;
329  }
330 
331  LOG(llevDebug, "done checking.\n");
332 }
333 
341 void dump_alchemy(void) {
342  recipelist *fl = formulalist;
343  recipe *formula = NULL;
344  linked_char *next;
345  int num_ingred = 1;
346 
347  fprintf(logfile, "\n");
348  while (fl) {
349  fprintf(logfile, "\n Formulae with %d ingredient%s %d Formulae with total_chance=%d\n", num_ingred, num_ingred > 1 ? "s." : ".", fl->number, fl->total_chance);
350  for (formula = fl->items; formula != NULL; formula = formula->next) {
351  const artifact *art = NULL;
352  char buf[MAX_BUF];
353  size_t i;
354 
355  for (i = 0; i < formula->arch_names; i++) {
356  const char *string = formula->arch_name[i];
357 
358  if (try_find_archetype(string) != NULL) {
359  art = locate_recipe_artifact(formula, i);
360  if (!art && strcmp(formula->title, "NONE"))
361  LOG(llevError, "Formula %s has no artifact\n", formula->title);
362  else {
363  if (strcmp(formula->title, "NONE"))
364  snprintf(buf, sizeof(buf), "%s of %s", string, formula->title);
365  else
366  strlcpy(buf, string, sizeof(buf));
367  fprintf(logfile, "%-30s(%d) bookchance %3d ", buf, formula->index, formula->chance);
368  fprintf(logfile, "skill %s", formula->skill);
369  fprintf(logfile, "\n");
370  if (formula->ingred != NULL) {
371  int nval = 0, tval = 0;
372  fprintf(logfile, "\tIngred: ");
373  for (next = formula->ingred; next != NULL; next = next->next) {
374  if (nval != 0)
375  fprintf(logfile, ",");
376  fprintf(logfile, "%s(%d)", next->name, (nval = strtoint(next->name)));
377  tval += nval;
378  }
379  fprintf(logfile, "\n");
380  if (tval != formula->index)
381  fprintf(logfile, "WARNING:ingredient list and formula values not equal.\n");
382  }
383  if (formula->skill != NULL)
384  fprintf(logfile, "\tSkill Required: %s", formula->skill);
385  if (formula->cauldron != NULL)
386  fprintf(logfile, "\tCauldron: %s\n", formula->cauldron);
387  fprintf(logfile, "\tDifficulty: %d\t Exp: %d\n", formula->diff, formula->exp);
388  }
389  } else
390  LOG(llevError, "Can't find archetype:%s for formula %s\n", string, formula->title);
391  }
392  }
393  fprintf(logfile, "\n");
394  fl = fl->next;
395  num_ingred++;
396  }
397 }
398 
413 archetype *find_treasure_by_name(const treasure *t, const char *name, int depth) {
414  treasurelist *tl;
415  archetype *at;
416 
417  if (depth > 10)
418  return NULL;
419 
420  while (t != NULL) {
421  if (t->name != NULL) {
422  tl = find_treasurelist(t->name);
423  at = find_treasure_by_name(tl->items, name, depth+1);
424  if (at != NULL)
425  return at;
426  } else {
427  if (!strcasecmp(t->item->clone.name, name))
428  return t->item;
429  }
430  if (t->next_yes != NULL) {
431  at = find_treasure_by_name(t->next_yes, name, depth);
432  if (at != NULL)
433  return at;
434  }
435  if (t->next_no != NULL) {
436  at = find_treasure_by_name(t->next_no, name, depth);
437  if (at != NULL)
438  return at;
439  }
440  t = t->next;
441  }
442  return NULL;
443 }
444 
453 void dump_alchemy_costs(void) {
454  recipelist *fl = formulalist;
455  recipe *formula = NULL;
456  linked_char *next;
457  int num_ingred = 1;
458  int num_errors = 0;
459  long cost;
460  long tcost;
461 
462  fprintf(logfile, "\n");
463  while (fl) {
464  fprintf(logfile, "\n Formulae with %d ingredient%s %d Formulae with total_chance=%d\n", num_ingred, num_ingred > 1 ? "s." : ".", fl->number, fl->total_chance);
465  for (formula = fl->items; formula != NULL; formula = formula->next) {
466  const artifact *art = NULL;
467  const archetype *at = NULL;
468  char buf[MAX_BUF];
469  size_t i;
470 
471  for (i = 0; i < formula->arch_names; i++) {
472  const char *string = formula->arch_name[i];
473 
474  if ((at = try_find_archetype(string)) != NULL) {
475  art = locate_recipe_artifact(formula, i);
476  if (!art && strcmp(formula->title, "NONE"))
477  LOG(llevError, "Formula %s has no artifact\n", formula->title);
478  else {
479  if (!strcmp(formula->title, "NONE"))
480  strlcpy(buf, string, sizeof(buf));
481  else
482  snprintf(buf, sizeof(buf), "%s of %s", string, formula->title);
483  fprintf(logfile, "\n%-40s bookchance %3d skill %s\n", buf, formula->chance, formula->skill);
484  if (formula->ingred != NULL) {
485  tcost = 0;
486  for (next = formula->ingred; next != NULL; next = next->next) {
488  if (cost < 0)
489  num_errors++;
490  fprintf(logfile, "\t%-33s%5ld\n", next->name, cost);
491  if (cost < 0 || tcost < 0)
492  tcost = -1;
493  else
494  tcost += cost;
495  }
496  if (art != NULL && art->item != NULL)
497  cost = at->clone.value*art->item->value;
498  else
499  cost = at->clone.value;
500  fprintf(logfile, "\t\tBuying result costs: %5ld", cost);
501  if (formula->yield > 1) {
502  fprintf(logfile, " to %ld (max %d items)\n", cost*formula->yield, formula->yield);
503  cost = cost*(formula->yield+1L)/2L;
504  } else
505  fprintf(logfile, "\n");
506  fprintf(logfile, "\t\tIngredients cost: %5ld\n\t\tComment: ", tcost);
507  if (tcost < 0)
508  fprintf(logfile, "Could not find some ingredients. Check the formula!\n");
509  else if (tcost > cost)
510  fprintf(logfile, "Ingredients are much too expensive. Useless formula.\n");
511  else if (tcost*2L > cost)
512  fprintf(logfile, "Ingredients are too expensive.\n");
513  else if (tcost*10L < cost)
514  fprintf(logfile, "Ingredients are too cheap.\n");
515  else
516  fprintf(logfile, "OK.\n");
517  }
518  }
519  } else
520  LOG(llevError, "Can't find archetype:%s for formula %s\n", string, formula->title);
521  }
522  }
523  fprintf(logfile, "\n");
524  fl = fl->next;
525  num_ingred++;
526  }
527  if (num_errors > 0)
528  fprintf(logfile, "WARNING: %d objects required by the formulae do not exist in the game.\n", num_errors);
529 }
530 
539 static const char *ingred_name(const char *name) {
540  const char *cp = name;
541 
542  if (atoi(cp))
543  cp = strchr(cp, ' ')+1;
544  return cp;
545 }
546 
555 static int numb_ingred(const char *buf) {
556  int numb;
557 
558  if ((numb = atoi(buf)))
559  return numb;
560  else
561  return 1;
562 }
563 
574 int strtoint(const char *buf) {
575  const char *cp = ingred_name(buf);
576  int val = 0, len = strlen(cp), mult = numb_ingred(buf);
577 
578  while (len) {
579  val += tolower(*cp);
580  cp++; len--;
581  }
582  return val*mult;
583 }
584 
595 const artifact *locate_recipe_artifact(const recipe *rp, size_t idx) {
596  object *item = create_archetype(rp->arch_name[idx]);
597  const artifactlist *at = NULL;
598  const artifact *art = NULL;
599 
600  if (!item)
601  return (artifact *)NULL;
602 
603  if ((at = find_artifactlist(item->type)))
604  for (art = at->items; art; art = art->next)
605  if (!strcmp(art->item->name, rp->title) && legal_artifact_combination(item, art))
606  break;
607 
609 
610  return art;
611 }
612 
620  recipelist *fl = NULL;
621  int number = 0, roll = 0;
622 
623  /* first, determine # of recipelist we have */
624  for (fl = get_formulalist(1); fl; fl = fl->next)
625  number++;
626 
627  /* now, randomly choose one */
628  if (number > 0)
629  roll = RANDOM()%number;
630 
631  fl = get_formulalist(1);
632  while (roll && fl) {
633  if (fl->next)
634  fl = fl->next;
635  else
636  break;
637  roll--;
638  }
639  if (!fl) /* failed! */
640  LOG(llevError, "get_random_recipelist(): no recipelists found!\n");
641  else if (fl->total_chance == 0)
642  fl = get_random_recipelist();
643 
644  return fl;
645 }
646 
656  recipelist *fl = rpl;
657  recipe *rp = NULL;
658  int r = 0;
659 
660  /* looks like we have to choose a random one */
661  if (fl == NULL)
662  if ((fl = get_random_recipelist()) == NULL)
663  return rp;
664 
665  if (fl->total_chance > 0) {
666  r = RANDOM()%fl->total_chance;
667  for (rp = fl->items; rp; rp = rp->next) {
668  r -= rp->chance;
669  if (r < 0)
670  break;
671  }
672  }
673  return rp;
674 }
675 
679 void free_all_recipes(void) {
680  recipelist *fl, *flnext;
681  recipe *formula = NULL, *next;
682  linked_char *lchar, *charnext;
683 
684  LOG(llevDebug, "Freeing all the recipes\n");
685  for (fl = formulalist; fl != NULL; fl = flnext) {
686  flnext = fl->next;
687 
688  for (formula = fl->items; formula != NULL; formula = next) {
689  next = formula->next;
690 
691  free(formula->arch_name[0]);
692  free(formula->arch_name);
693  if (formula->title)
694  free_string(formula->title);
695  if (formula->skill)
696  free_string(formula->skill);
697  if (formula->cauldron)
698  free_string(formula->cauldron);
699  if (formula->failure_arch)
700  free_string(formula->failure_arch);
701  if (formula->failure_message)
702  free_string(formula->failure_message);
703  for (lchar = formula->ingred; lchar; lchar = charnext) {
704  charnext = lchar->next;
705  free_string(lchar->name);
706  free(lchar);
707  }
708  if (formula->tool)
709  free(formula->tool[0]);
710  free(formula->tool);
711  free(formula);
712  }
713  free(fl);
714  }
715  formulalist = NULL;
716 }
717 
729 static void build_stringlist(const char *str, char ***result_list, size_t *result_size) {
730  char *dup;
731  char *p;
732  size_t size;
733  size_t i;
734 
735  dup = strdup_local(str);
736  if (dup == NULL)
738 
739  size = 0;
740  for (p = strtok(dup, ","); p != NULL; p = strtok(NULL, ","))
741  size++;
742 
743  assert(size > 0);
744  *result_list = malloc(sizeof(**result_list) * size);
745  if (*result_list == NULL)
747  *result_size = size;
748 
749  for (i = 0; i < size; i++) {
750  (*result_list)[i] = dup;
751  dup = dup+strlen(dup)+1;
752  }
753 }
754 
762 recipe *find_recipe_for_tool(const char *tool, recipe *from) {
763  size_t t;
765  recipe *test = from ? from->next : list->items;
766 
767  while (list) {
768  while (test) {
769  for (t = 0; t < test->tool_size; t++) {
770  if (strcmp(test->tool[t], tool) == 0) {
771  return test;
772  }
773  }
774  test = test->next;
775  }
776 
777  list = list->next;
778  }
779 
780  return NULL;
781 }
782 
788 const Face *recipe_get_face(const recipe *rp) {
789  const artifact *art;
790  archetype *arch;
791  object *item;
792  const Face *face;
793 
794  if (rp->arch_names == 0)
795  return NULL;
796 
798  if (arch == NULL) {
799  return NULL;
800  }
801  if (strcmp(rp->title, "NONE") == 0) {
802  return arch->clone.face;
803  }
804 
805  art = locate_recipe_artifact(rp, 0);
806  if (art == NULL)
807  return arch->clone.face;
808 
809  face = arch->clone.face;
813  if (item->face != NULL && item->face != blank_face)
814  face = item->face;
816 
817  return face;
818 }
recipestruct::arch_names
size_t arch_names
Definition: recipe.h:12
give.next
def next
Definition: give.py:44
Face
Definition: face.h:14
global.h
FREE_OBJ_NO_DESTROY_CALLBACK
#define FREE_OBJ_NO_DESTROY_CALLBACK
Definition: object.h:532
tolower
#define tolower(C)
Definition: c_new.c:30
get_formulalist
recipelist * get_formulalist(int i)
Definition: recipe.c:96
object_free
void object_free(object *ob, int flags)
Definition: object.c:1565
get_empty_formula
static recipe * get_empty_formula(void)
Definition: recipe.c:77
add_string
sstring add_string(const char *str)
Definition: shstr.c:124
llevError
@ llevError
Definition: logger.h:11
give_artifact_abilities
void give_artifact_abilities(object *op, const object *artifact)
Definition: artifact.c:194
recipestruct::yield
int yield
Definition: recipe.h:21
strdup_local
#define strdup_local
Definition: compat.h:29
archininventory.arch
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
Definition: archininventory.py:16
obj::value
int32_t value
Definition: object.h:353
find_recipe_for_tool
recipe * find_recipe_for_tool(const char *tool, recipe *from)
Definition: recipe.c:762
recipestruct::tool
char ** tool
Definition: recipe.h:32
ingred_name
static const char * ingred_name(const char *name)
Definition: recipe.c:539
guildoracle.list
list
Definition: guildoracle.py:87
init_recipelist
static recipelist * init_recipelist(void)
Definition: recipe.c:58
recipeliststruct::next
struct recipeliststruct * next
Definition: recipe.h:41
locate_recipe_artifact
const artifact * locate_recipe_artifact(const recipe *rp, size_t idx)
Definition: recipe.c:595
blank_face
const Face * blank_face
Definition: image.c:35
dump_alchemy_costs
void dump_alchemy_costs(void)
Definition: recipe.c:453
recipestruct::title
sstring title
Definition: recipe.h:11
bufferreader_next_line
char * bufferreader_next_line(BufferReader *br)
Definition: bufferreader.c:102
bufferreader_current_line
size_t bufferreader_current_line(BufferReader *br)
Definition: bufferreader.c:140
find_treasurelist
treasurelist * find_treasurelist(const char *name)
Definition: assets.cpp:257
artifactliststruct::items
struct artifactstruct * items
Definition: artifact.h:30
free_all_recipes
void free_all_recipes(void)
Definition: recipe.c:679
Ice.tmp
int tmp
Definition: Ice.py:207
SEE_LAST_ERROR
@ SEE_LAST_ERROR
Definition: define.h:52
get_random_recipelist
static recipelist * get_random_recipelist(void)
Definition: recipe.c:619
get_random_recipe
recipe * get_random_recipe(recipelist *rpl)
Definition: recipe.c:655
npc_dialog.filename
filename
Definition: npc_dialog.py:99
recipestruct::ingred_count
int ingred_count
Definition: recipe.h:23
recipeliststruct::number
int number
Definition: recipe.h:39
init_formulae
void init_formulae(BufferReader *reader, const char *filename)
Definition: recipe.c:167
recipestruct::chance
int chance
Definition: recipe.h:14
treasurestruct
Definition: treasure.h:63
find_artifactlist
const artifactlist * find_artifactlist(int type)
Definition: artifact.c:647
linked_char
Definition: global.h:86
reputation_trigger_connect.check
def check()
Definition: reputation_trigger_connect.py:18
archt
Definition: object.h:468
free_string
void free_string(sstring str)
Definition: shstr.c:280
strtoint
int strtoint(const char *buf)
Definition: recipe.c:574
recipestruct
Definition: recipe.h:10
dump_alchemy
void dump_alchemy(void)
Definition: recipe.c:341
recipeliststruct::total_chance
int total_chance
Definition: recipe.h:38
check_recipes
void check_recipes()
Definition: recipe.c:146
obj::name
sstring name
Definition: object.h:312
linked_char::name
const char * name
Definition: global.h:87
artifactstruct::next
struct artifactstruct * next
Definition: artifact.h:18
recipestruct::cauldron
sstring cauldron
Definition: recipe.h:27
fatal
void fatal(enum fatal_error err)
Definition: utils.c:597
recipestruct::arch_name
char ** arch_name
Definition: recipe.h:13
make_face_from_files.str
str
Definition: make_face_from_files.py:24
recipestruct::tool_size
size_t tool_size
Definition: recipe.h:33
check_recipe
static int check_recipe(const recipe *rp)
Definition: recipe.c:118
recipestruct::exp
int exp
Definition: recipe.h:17
linked_char::next
struct linked_char * next
Definition: global.h:88
artifactliststruct
Definition: artifact.h:26
recipestruct::keycode
sstring keycode
Definition: recipe.h:25
object_give_identified_properties
void object_give_identified_properties(object *op)
Definition: item.c:1343
recipeliststruct
Definition: recipe.h:37
logfile
EXTERN FILE * logfile
Definition: global.h:136
recipe_get_face
const Face * recipe_get_face(const recipe *rp)
Definition: recipe.c:788
build_stringlist
static void build_stringlist(const char *str, char ***result_list, size_t *result_size)
Definition: recipe.c:729
numb_ingred
static int numb_ingred(const char *buf)
Definition: recipe.c:555
recipestruct::failure_message
sstring failure_message
Definition: recipe.h:29
recipestruct::ingred
linked_char * ingred
Definition: recipe.h:22
strlcpy
size_t strlcpy(char *dst, const char *src, size_t size)
Definition: porting.c:220
MAX_BUF
#define MAX_BUF
Definition: define.h:35
artifactstruct
Definition: artifact.h:14
create_archetype
object * create_archetype(const char *name)
Definition: arch.cpp:281
RANDOM
#define RANDOM()
Definition: define.h:642
recipestruct::skill
sstring skill
Definition: recipe.h:26
recipe_find_ingredient_cost
long recipe_find_ingredient_cost(const char *name)
Definition: assets.cpp:572
treasureliststruct::items
struct treasurestruct * items
Definition: treasure.h:89
Floor.t
t
Definition: Floor.py:62
archt::clone
object clone
Definition: object.h:472
item
Definition: item.py:1
LOG
void LOG(LogLevel logLevel, const char *format,...)
Definition: logger.c:51
recipestruct::min_level
int min_level
Definition: recipe.h:30
autojail.value
value
Definition: autojail.py:6
formulalist
static recipelist * formulalist
Definition: recipe.c:48
assets.h
buf
StringBuffer * buf
Definition: readable.c:1606
recipestruct::next
struct recipestruct * next
Definition: recipe.h:24
recipestruct::diff
int diff
Definition: recipe.h:16
arch_to_object
object * arch_to_object(archetype *at)
Definition: arch.cpp:232
recipestruct::transmute
int transmute
Definition: recipe.h:19
strcasecmp
int strcasecmp(const char *s1, const char *s2)
artifactstruct::item
object * item
Definition: artifact.h:15
recipestruct::is_combination
int is_combination
Definition: recipe.h:31
recipeliststruct::items
struct recipestruct * items
Definition: recipe.h:40
object_free_drop_inventory
void object_free_drop_inventory(object *ob)
Definition: object.c:1533
recipestruct::index
int index
Definition: recipe.h:18
try_find_archetype
archetype * try_find_archetype(const char *name)
Definition: assets.cpp:282
find_treasure_by_name
archetype * find_treasure_by_name(const treasure *t, const char *name, int depth)
Definition: recipe.c:413
FREE_OBJ_FREE_INVENTORY
#define FREE_OBJ_FREE_INVENTORY
Definition: object.h:531
recipestruct::failure_arch
sstring failure_arch
Definition: recipe.h:28
say.item
dictionary item
Definition: say.py:149
diamondslots.cost
int cost
Definition: diamondslots.py:21
check_formulae
void check_formulae(void)
Definition: recipe.c:284
legal_artifact_combination
int legal_artifact_combination(const object *op, const artifact *art)
Definition: artifact.c:216
OUT_OF_MEMORY
@ OUT_OF_MEMORY
Definition: define.h:48
BufferReader
Definition: bufferreader.c:21
ring_occidental_mages.r
r
Definition: ring_occidental_mages.py:6
object.h
llevDebug
@ llevDebug
Definition: logger.h:13
treasureliststruct
Definition: treasure.h:82
give.name
name
Definition: give.py:27