--- deliantra/server/common/recipe.C 2006/12/12 20:53:02 1.8 +++ deliantra/server/common/recipe.C 2007/01/02 23:39:21 1.12 @@ -18,9 +18,10 @@ * arch potion_generic */ +#include + #include #include -#include static void build_stringlist (const char *str, char ***result_list, size_t * result_size); @@ -95,13 +96,13 @@ if (!art && strcmp (rp->title, "NONE") != 0) { - LOG (llevError, "\nWARNING: Formula %s of %s has no artifact.\n", rp->arch_name[i], &rp->title); + LOG (llevError, "WARNING: Formula %s of %s has no artifact.\n", rp->arch_name[i], &rp->title); result = 0; } } else { - LOG (llevError, "\nWARNING: Can't find archetype %s for formula %s\n", rp->arch_name[i], &rp->title); + LOG (llevError, "WARNING: Can't find archetype %s for formula %s\n", rp->arch_name[i], &rp->title); result = 0; } } @@ -135,7 +136,7 @@ has_been_done = 1; sprintf (filename, "%s/formulae", settings.datadir); - LOG (llevDebug, "Reading alchemical formulae from %s...", filename); + LOG (llevDebug, "Reading alchemical formulae from %s...\n", filename); if ((fp = open_and_uncompress (filename, 0, &comp)) == NULL) { LOG (llevError, "Can't open %s.\n", filename); @@ -356,36 +357,44 @@ archetype *at; if (depth > 10) - return NULL; - while (t != NULL) + return 0; + + while (t) { - if (t->name != NULL) + if (t->name) { tl = find_treasurelist (t->name); - at = find_treasure_by_name (tl->items, name, depth + 1); - if (at != NULL) - return at; + + if (tl) + { + at = find_treasure_by_name (tl->items, name, depth + 1); + + if (at) + return at; + } } else { if (!strcasecmp (t->item->clone.name, name)) return t->item; } - if (t->next_yes != NULL) + + if (t->next_yes) { at = find_treasure_by_name (t->next_yes, name, depth); - if (at != NULL) + if (at) return at; } - if (t->next_no != NULL) + + if (t->next_no) { at = find_treasure_by_name (t->next_no, name, depth); - if (at != NULL) + if (at) return at; } t = t->next; } - return NULL; + return 0; } /* If several archetypes have the same name, the value of the first @@ -469,7 +478,7 @@ if (at->clone.randomitems != NULL) { at2 = find_treasure_by_name (at->clone.randomitems->items, part2, 0); - if (at2 != NULL) + if (at2) return mult * at2->clone.value * isqrt (at->clone.level * 2); } } @@ -615,7 +624,7 @@ if (!strcmp (art->item->name, rp->title)) break; - item->destroy (0); + item->destroy (); return art; } @@ -737,7 +746,7 @@ size_t size; size_t i; - dup = strdup_local (str); + dup = strdup (str); if (dup == NULL) fatal (OUT_OF_MEMORY);