Go to the documentation of this file.
100 while (fl && number > 1) {
101 if (!(fl = fl->
next))
125 if (strcmp(rp->
title,
"NONE")) {
178 if (*
buf ==
'#' || *
buf ==
'\0')
184 if (!strncmp(cp,
"Remove ", 7)) {
185 if (strcmp(cp + 7,
"*") == 0) {
193 if (!strncmp(cp,
"Object", 6)) {
196 }
else if (formula == NULL) {
199 }
else if (!strncmp(cp,
"keycode", 7)) {
201 }
else if (sscanf(cp,
"trans %d", &
value)) {
203 }
else if (sscanf(cp,
"yield %d", &
value)) {
205 }
else if (sscanf(cp,
"chance %d", &
value)) {
207 }
else if (sscanf(cp,
"exp %d", &
value)) {
209 }
else if (sscanf(cp,
"diff %d", &
value)) {
211 }
else if (!strncmp(cp,
"ingred", 6)) {
214 cp = strchr(cp,
' ')+1;
216 if ((
next = strchr(cp,
',')) != NULL) {
224 while (*cp !=
'\0' && cp[strlen(cp) - 1] ==
' ')
225 cp[strlen(cp) - 1] =
'\0';
234 }
while ((cp =
next) != NULL);
246 }
else if (!strncmp(cp,
"arch", 4)) {
248 }
else if (!strncmp(cp,
"skill", 5)) {
250 }
else if (!strncmp(cp,
"cauldron", 8)) {
252 }
else if (!strncmp(cp,
"failure_arch ", 13)) {
254 }
else if (!strncmp(cp,
"failure_message ", 16)) {
256 }
else if (sscanf(cp,
"min_level %d", &
value)) {
258 }
else if (!strncmp(cp,
"tool ", 5)) {
260 }
else if (sscanf(cp,
"combination %d", &
value)) {
271 for (formula = fl->
items; formula; formula = formula->
next) {
296 int numb = 1, tool_match;
297 size_t tool_i,tool_j;
302 for (formula = fl->
items; formula != NULL; formula = formula->
next) {
312 for (tool_i = 0; tool_i < formula->
tool_size; ++tool_i)
314 for (tool_j = 0; tool_j <
check->tool_size; ++tool_j)
315 if (strcmp(formula->
tool[tool_i],
check->tool[tool_j]) == 0) {
326 LOG(
llevError,
"Formulae [%s] of %s and [%s] of %s have matching index id (%d)\n",
330 for (
size_t idx = 0; idx < formula->
arch_names; idx++) {
332 LOG(
llevError,
"Formulae %s of %s (%d ingredients) references non existent archetype %s\n",
358 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);
359 for (formula = fl->
items; formula != NULL; formula = formula->
next) {
365 const char *
string = formula->
arch_name[i];
369 if (!art && strcmp(formula->
title,
"NONE"))
372 if (strcmp(formula->
title,
"NONE"))
373 snprintf(
buf,
sizeof(
buf),
"%s of %s",
string, formula->
title);
379 if (formula->
ingred != NULL) {
380 int nval = 0, tval = 0;
381 fprintf(
logfile,
"\tIngred: ");
389 if (tval != formula->
index)
390 fprintf(
logfile,
"WARNING:ingredient list and formula values not equal.\n");
392 if (formula->
skill != NULL)
393 fprintf(
logfile,
"\tSkill Required: %s", formula->
skill);
396 fprintf(
logfile,
"\tDifficulty: %d\t Exp: %d\n", formula->
diff, formula->
exp);
399 LOG(
llevError,
"Can't find archetype:%s for formula %s\n",
string, formula->
title);
430 if (
t->name != NULL) {
439 if (
t->next_yes != NULL) {
444 if (
t->next_no != NULL) {
473 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);
474 for (formula = fl->
items; formula != NULL; formula = formula->
next) {
481 const char *
string = formula->
arch_name[i];
485 if (!art && strcmp(formula->
title,
"NONE"))
488 if (!strcmp(formula->
title,
"NONE"))
491 snprintf(
buf,
sizeof(
buf),
"%s of %s",
string, formula->
title);
493 if (formula->
ingred != NULL) {
500 if (
cost < 0 || tcost < 0)
505 if (art != NULL && art->
item != NULL)
509 fprintf(
logfile,
"\t\tBuying result costs: %5ld",
cost);
510 if (formula->
yield > 1) {
515 fprintf(
logfile,
"\t\tIngredients cost: %5ld\n\t\tComment: ", tcost);
517 fprintf(
logfile,
"Could not find some ingredients. Check the formula!\n");
518 else if (tcost >
cost)
519 fprintf(
logfile,
"Ingredients are much too expensive. Useless formula.\n");
520 else if (tcost*2L >
cost)
521 fprintf(
logfile,
"Ingredients are too expensive.\n");
522 else if (tcost*10L <
cost)
523 fprintf(
logfile,
"Ingredients are too cheap.\n");
529 LOG(
llevError,
"Can't find archetype:%s for formula %s\n",
string, formula->
title);
537 fprintf(
logfile,
"WARNING: %d objects required by the formulae do not exist in the game.\n", num_errors);
549 const char *cp =
name;
552 cp = strchr(cp,
' ')+1;
567 if ((numb = atoi(
buf)))
613 for (art = at->
items; art; art = art->
next)
630 int number = 0, roll = 0;
649 LOG(
llevError,
"get_random_recipelist(): no recipelists found!\n");
676 for (rp = fl->
items; rp; rp = rp->
next) {
697 for (formula = fl->
items; formula != NULL; formula =
next) {
712 for (lchar = formula->
ingred; lchar; lchar = charnext) {
713 charnext = lchar->
next;
718 free(formula->
tool[0]);
749 for (p = strtok(dup,
","); p != NULL; p = strtok(NULL,
","))
753 *result_list = malloc(
sizeof(**result_list) * size);
754 if (*result_list == NULL)
758 for (i = 0; i < size; i++) {
759 (*result_list)[i] = dup;
760 dup = dup+strlen(dup)+1;
779 if (strcmp(test->
tool[
t], tool) == 0) {
810 if (strcmp(rp->
title,
"NONE") == 0) {
811 return arch->clone.face;
816 return arch->clone.face;
818 face =
arch->clone.face;
#define FREE_OBJ_NO_DESTROY_CALLBACK
recipelist * get_formulalist(int i)
void object_free(object *ob, int flags)
static recipe * get_empty_formula(void)
sstring add_string(const char *str)
void give_artifact_abilities(object *op, const object *artifact)
arch
DIALOGCHECK MINARGS 1 MAXARGS 1
recipe * find_recipe_for_tool(const char *tool, recipe *from)
static const char * ingred_name(const char *name)
static recipelist * init_recipelist(void)
struct recipeliststruct * next
const artifact * locate_recipe_artifact(const recipe *rp, size_t idx)
void dump_alchemy_costs(void)
char * bufferreader_next_line(BufferReader *br)
size_t bufferreader_current_line(BufferReader *br)
treasurelist * find_treasurelist(const char *name)
struct artifactstruct * items
void free_all_recipes(void)
static recipelist * get_random_recipelist(void)
recipe * get_random_recipe(recipelist *rpl)
void init_formulae(BufferReader *reader, const char *filename)
void free_string(sstring str)
int strtoint(const char *buf)
artifactlist * find_artifactlist(int type)
struct artifactstruct * next
void fatal(enum fatal_error err)
static int check_recipe(const recipe *rp)
struct linked_char * next
void object_give_identified_properties(object *op)
const Face * recipe_get_face(const recipe *rp)
static void build_stringlist(const char *str, char ***result_list, size_t *result_size)
static int numb_ingred(const char *buf)
size_t strlcpy(char *dst, const char *src, size_t size)
object * create_archetype(const char *name)
long recipe_find_ingredient_cost(const char *name)
struct treasurestruct * items
void LOG(LogLevel logLevel, const char *format,...)
static recipelist * formulalist
struct recipestruct * next
object * arch_to_object(archetype *at)
int strcasecmp(const char *s1, const char *s2)
struct recipestruct * items
void object_free_drop_inventory(object *ob)
archetype * try_find_archetype(const char *name)
archetype * find_treasure_by_name(const treasure *t, const char *name, int depth)
#define FREE_OBJ_FREE_INVENTORY
void check_formulae(void)
int legal_artifact_combination(const object *op, const artifact *art)