--- deliantra/server/common/recipe.C 2006/09/14 21:16:11 1.6 +++ deliantra/server/common/recipe.C 2006/12/14 00:08:52 1.10 @@ -1,5 +1,3 @@ - - /* Basic stuff for use with the alchemy code. Clearly some of this stuff * could go into server/alchemy, but I left it here just in case it proves * more generally useful. @@ -358,36 +356,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 @@ -471,7 +477,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); } } @@ -617,7 +623,7 @@ if (!strcmp (art->item->name, rp->title)) break; - free_object (item); + item->destroy (); return art; }