--- deliantra/server/common/recipe.C 2007/07/01 05:00:18 1.23 +++ deliantra/server/common/recipe.C 2008/05/06 16:55:25 1.26 @@ -1,11 +1,11 @@ /* - * This file is part of Crossfire TRT, the Roguelike Realtime MORPG. + * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Crossfire TRT team + * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * - * Crossfire TRT is free software: you can redistribute it and/or modify + * Deliantra is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. @@ -18,7 +18,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . * - * The authors can be reached via e-mail to + * The authors can be reached via e-mail to */ /* Basic stuff for use with the alchemy code. Clearly some of this stuff @@ -284,78 +284,6 @@ } -/* Borrowed (again) from the artifacts code for this */ - -void -dump_alchemy (void) -{ - recipelist *fl = formulalist; - recipe *formula = NULL; - linked_char *next; - int num_ingred = 1; - - fprintf (logfile, "\n"); - while (fl) - { - 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); - for (formula = fl->items; formula; formula = formula->next) - { - artifact *art = NULL; - char buf[MAX_BUF]; - size_t i; - - for (i = 0; i < formula->arch_names; i++) - { - const char *string = formula->arch_name[i]; - - if (archetype::find (string) != NULL) - { - art = locate_recipe_artifact (formula, i); - if (!art && strcmp (formula->title, "NONE")) - LOG (llevError, "Formula %s has no artifact!\n", &formula->title); - else - { - if (strcmp (formula->title, "NONE")) - sprintf (buf, "%s of %s", string, &formula->title); - else - sprintf (buf, "%s", string); - fprintf (logfile, "%-30s(%d) bookchance %3d ", buf, formula->index, formula->chance); - fprintf (logfile, "skill %s", &formula->skill); - fprintf (logfile, "\n"); - if (formula->ingred != NULL) - { - int nval = 0, tval = 0; - - fprintf (logfile, "\tIngred: "); - for (next = formula->ingred; next != NULL; next = next->next) - { - if (nval != 0) - fprintf (logfile, ","); - fprintf (logfile, "%s(%d)", &next->name, (nval = strtoint (next->name))); - tval += nval; - } - fprintf (logfile, "\n"); - if (tval != formula->index) - fprintf (logfile, "WARNING:ingredient list and formula values not equal.\n"); - } - if (formula->skill != NULL) - fprintf (logfile, "\tSkill Required: %s", &formula->skill); - if (formula->cauldron != NULL) - fprintf (logfile, "\tCauldron: %s\n", &formula->cauldron); - fprintf (logfile, "\tDifficulty: %d\t Exp: %d\n", formula->diff, formula->exp); - } - } - else - LOG (llevError, "Can't find archetype:%s for formula %s\n", string, &formula->title); - } - } - fprintf (logfile, "\n"); - fl = fl->next; - num_ingred++; - } -} - /* 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). */ @@ -487,98 +415,6 @@ return -1; } -/* code copied from dump_alchemy() and modified by Raphael Quinet */ -void -dump_alchemy_costs (void) -{ - recipelist *fl = formulalist; - recipe *formula = NULL; - linked_char *next; - int num_ingred = 1; - int num_errors = 0; - long cost; - long tcost; - - fprintf (logfile, "\n"); - while (fl) - { - 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); - for (formula = fl->items; formula; formula = formula->next) - { - artifact *art = NULL; - archetype *at = NULL; - char buf[MAX_BUF]; - size_t i; - - for (i = 0; i < formula->arch_names; i++) - { - const char *string = formula->arch_name[i]; - - if ((at = archetype::find (string)) != NULL) - { - art = locate_recipe_artifact (formula, i); - if (!art && strcmp (formula->title, "NONE")) - LOG (llevError, "Formula %s has no artifact\n", &formula->title); - else - { - if (!strcmp (formula->title, "NONE")) - sprintf (buf, "%s", string); - else - sprintf (buf, "%s of %s", string, &formula->title); - fprintf (logfile, "\n%-40s bookchance %3d skill %s\n", buf, formula->chance, &(formula->skill)); - if (formula->ingred != NULL) - { - tcost = 0; - for (next = formula->ingred; next != NULL; next = next->next) - { - cost = find_ingred_cost (next->name); - if (cost < 0) - num_errors++; - fprintf (logfile, "\t%-33s%5ld\n", &next->name, cost); - if (cost < 0 || tcost < 0) - tcost = -1; - else - tcost += cost; - } - if (art != NULL && art->item != NULL) - cost = at->value * art->item->value; - else - cost = at->value; - fprintf (logfile, "\t\tBuying result costs: %5ld", cost); - if (formula->yield > 1) - { - fprintf (logfile, " to %ld (max %d items)\n", cost * formula->yield, formula->yield); - cost = cost * (formula->yield + 1L) / 2L; - } - else - fprintf (logfile, "\n"); - fprintf (logfile, "\t\tIngredients cost: %5ld\n\t\tComment: ", tcost); - if (tcost < 0) - fprintf (logfile, "Could not find some ingredients. Check the formula!\n"); - else if (tcost > cost) - fprintf (logfile, "Ingredients are much too expensive. Useless formula.\n"); - else if (tcost * 2L > cost) - fprintf (logfile, "Ingredients are too expensive.\n"); - else if (tcost * 10L < cost) - fprintf (logfile, "Ingredients are too cheap.\n"); - else - fprintf (logfile, "OK.\n"); - } - } - } - else - LOG (llevError, "Can't find archetype:%s for formula %s\n", string, &formula->title); - } - } - fprintf (logfile, "\n"); - fl = fl->next; - num_ingred++; - } - if (num_errors > 0) - fprintf (logfile, "WARNING: %d objects required by the formulae do not exist in the game.\n", num_errors); -} - const char * ingred_name (const char *name) { @@ -586,6 +422,7 @@ if (atoi (cp)) cp = strchr (cp, ' ') + 1; + return cp; }