--- deliantra/server/common/recipe.C 2007/05/28 21:21:40 1.21 +++ deliantra/server/common/recipe.C 2007/06/04 13:04:00 1.22 @@ -377,7 +377,7 @@ } else { - if (t->item && !strcasecmp (t->item->clone.name, name)) + if (t->item && !strcasecmp (t->item->object::name, name)) return t->item; } @@ -406,7 +406,6 @@ long find_ingred_cost (const char *name) { - archetype *at; archetype *at2; artifactlist *al; artifact *art; @@ -429,17 +428,17 @@ mult = 1; /* first, try to match the name of an archetype */ - for (at = first_archetype; at != NULL; at = at->next) + for_all_archetypes (at) { - if (at->clone.title != NULL) + if (at->title != NULL) { /* inefficient, but who cares? */ - sprintf (part1, "%s %s", &at->clone.name, &at->clone.title); + sprintf (part1, "%s %s", &at->object::name, &at->title); if (!strcasecmp (part1, name)) - return mult * at->clone.value; + return mult * at->value; } - if (!strcasecmp (at->clone.name, name)) - return mult * at->clone.value; + if (!strcasecmp (at->object::name, name)) + return mult * at->value; } /* second, try to match an artifact ("arch of something") */ @@ -449,21 +448,20 @@ strcpy (part1, name); part1[cp - name] = '\0'; strcpy (part2, cp + 4); + /* find the first archetype matching the first part of the name */ - for (at = first_archetype; at; at = at->next) - if (!strcasecmp (at->clone.name, part1) && at->clone.title == NULL) - break; - if (at != NULL) - { - /* find the first artifact derived from that archetype (same type) */ - for (al = first_artifactlist; al; al = al->next) - if (al->type == at->clone.type) - { - for (art = al->items; art; art = art->next) - if (!strcasecmp (art->item->name, part2)) - return mult * at->clone.value * art->item->value; - } - } + for_all_archetypes (at) + if (!strcasecmp (at->object::name, part1) && at->title == NULL) + { + /* find the first artifact derived from that archetype (same type) */ + for (al = first_artifactlist; al; al = al->next) + if (al->type == at->type) + { + for (art = al->items; art; art = art->next) + if (!strcasecmp (art->item->name, part2)) + return mult * at->value * art->item->value; + } + } } /* third, try to match a body part ("arch's something") */ @@ -474,14 +472,14 @@ part1[cp - name] = '\0'; strcpy (part2, cp + 3); /* examine all archetypes matching the first part of the name */ - for (at = first_archetype; at; at = at->next) - if (!strcasecmp (at->clone.name, part1) && at->clone.title == NULL) + for_all_archetypes (at) + if (!strcasecmp (at->object::name, part1) && at->title == NULL) { - if (at->clone.randomitems) + if (at->randomitems) { - at2 = find_treasure_by_name (at->clone.randomitems->items, part2, 0); + at2 = find_treasure_by_name (at->randomitems->items, part2, 0); if (at2) - return mult * at2->clone.value * isqrt (at->clone.level * 2); + return mult * at2->value * isqrt (at->level * 2); } } } @@ -545,9 +543,9 @@ tcost += cost; } if (art != NULL && art->item != NULL) - cost = at->clone.value * art->item->value; + cost = at->value * art->item->value; else - cost = at->clone.value; + cost = at->value; fprintf (logfile, "\t\tBuying result costs: %5ld", cost); if (formula->yield > 1) { @@ -618,7 +616,7 @@ archetype *at = archetype::find (rp->arch_name [idx]); if (at) - if (artifactlist *al = find_artifactlist (at->clone.type)) + if (artifactlist *al = find_artifactlist (at->type)) for (artifact *art = al->items; art; art = art->next) if (art->item->name == rp->title) return art;