… | |
… | |
76 | * ok, but the possibility of duplicate hashes is certainly possible - msw |
76 | * ok, but the possibility of duplicate hashes is certainly possible - msw |
77 | */ |
77 | */ |
78 | static int |
78 | static int |
79 | content_recipe_value (object *op) |
79 | content_recipe_value (object *op) |
80 | { |
80 | { |
81 | char name[MAX_BUF]; |
|
|
82 | object *tmp = op->inv; |
81 | object *tmp = op->inv; |
83 | int tval = 0, formula = 0; |
82 | int formula = 0; |
84 | |
83 | |
85 | while (tmp) |
84 | while (tmp) |
86 | { |
85 | { |
87 | tval = 0; |
86 | const char *name = tmp->title |
88 | assign (name, tmp->name); |
|
|
89 | if (tmp->title) |
|
|
90 | sprintf (name, "%s %s", &tmp->name, &tmp->title); |
87 | ? (const char *)format ("%s %s", &tmp->name, &tmp->title) |
|
|
88 | : tmp->name; |
|
|
89 | |
91 | tval = (strtoint (name) * (tmp->nrof ? tmp->nrof : 1)); |
90 | int tval = strtoint (name) * tmp->number_of (); |
92 | #ifdef ALCHEMY_DEBUG |
91 | #ifdef ALCHEMY_DEBUG |
93 | LOG (llevDebug, "Got ingredient %d %s(%d)\n", tmp->nrof ? tmp->nrof : 1, name, tval); |
92 | LOG (llevDebug, "Got ingredient %d %s(%d)\n", tmp->nrof ? tmp->nrof : 1, name, tval); |
94 | #endif |
93 | #endif |
95 | formula += tval; |
94 | formula += tval; |
96 | tmp = tmp->below; |
95 | tmp = tmp->below; |
97 | } |
96 | } |
98 | #ifdef ALCHEMY_DEBUG |
97 | #ifdef ALCHEMY_DEBUG |
99 | LOG (llevDebug, " Formula value=%d\n", formula); |
98 | LOG (llevDebug, " Formula value=%d\n", formula); |
100 | #endif |
99 | #endif |
|
|
100 | |
101 | return formula; |
101 | return formula; |
102 | } |
102 | } |
103 | |
103 | |
104 | /** |
104 | /** |
105 | * Returns total number of items in op |
105 | * Returns total number of items in op |