--- deliantra/server/common/recipe.C 2009/10/12 14:00:57 1.28 +++ deliantra/server/common/recipe.C 2009/11/06 12:27:05 1.29 @@ -133,6 +133,39 @@ return result; } +/* check_formulae()- since we are doing a squential search on the + * formulae lists now, we have to be carefull that we dont have 2 + * formula with the exact same index value. Under the new nbatches + * code, it is possible to have multiples of ingredients in a cauldron + * which could result in an index formula mismatch. We *don't* check for + * that possibility here. -b.t. + */ +void +check_formulae (void) +{ + recipelist *fl; + recipe *check, *formula; + int numb = 1; + + LOG (llevDebug, "Checking formulae lists...\n"); + + for (fl = formulalist; fl; fl = fl->next) + { + for (formula = fl->items; formula; formula = formula->next) + for (check = formula->next; check; check = check->next) + if (check->index == formula->index) + { + LOG (llevError, " ERROR: On %d ingred list: ", numb); + LOG (llevError, "Formulae [%s] of %s and [%s] of %s have matching index id (%d)\n", + formula->arch_name[0], &formula->title, check->arch_name[0], &check->title, formula->index); + } + numb++; + } + + LOG (llevDebug, "done.\n"); + +} + /* * init_formulae() - Builds up the lists of formula from the file in * the libdir. -b.t. @@ -252,39 +285,6 @@ check_formulae (); } -/* check_formulae()- since we are doing a squential search on the - * formulae lists now, we have to be carefull that we dont have 2 - * formula with the exact same index value. Under the new nbatches - * code, it is possible to have multiples of ingredients in a cauldron - * which could result in an index formula mismatch. We *don't* check for - * that possibility here. -b.t. - */ -void -check_formulae (void) -{ - recipelist *fl; - recipe *check, *formula; - int numb = 1; - - LOG (llevDebug, "Checking formulae lists...\n"); - - for (fl = formulalist; fl; fl = fl->next) - { - for (formula = fl->items; formula; formula = formula->next) - for (check = formula->next; check; check = check->next) - if (check->index == formula->index) - { - LOG (llevError, " ERROR: On %d ingred list: ", numb); - LOG (llevError, "Formulae [%s] of %s and [%s] of %s have matching index id (%d)\n", - formula->arch_name[0], &formula->title, check->arch_name[0], &check->title, formula->index); - } - numb++; - } - - LOG (llevDebug, "done.\n"); - -} - /* Find a treasure with a matching name. The 'depth' parameter is * only there to prevent infinite loops in treasure lists (a list * referencing another list pointing back to the first one). */ @@ -427,11 +427,22 @@ return cp; } +int +numb_ingred (const char *buf) +{ + int numb; + + if ((numb = atoi (buf))) + return numb; + else + return 1; +} + /* strtoint() - we use this to convert buf into an integer * equal to the coadded sum of the (lowercase) character * ASCII values in buf (times prepended integers). + * Some kind of hashing. */ - int strtoint (const char *buf) { @@ -444,6 +455,7 @@ cp++; len--; } + return val * mult; } @@ -461,17 +473,6 @@ return 0; } -int -numb_ingred (const char *buf) -{ - int numb; - - if ((numb = atoi (buf))) - return numb; - else - return 1; -} - recipelist * get_random_recipelist (void) {