ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/alchemy.C
(Generate patch)

Comparing deliantra/server/server/alchemy.C (file contents):
Revision 1.18 by pippijn, Mon Jan 15 21:06:19 2007 UTC vs.
Revision 1.22 by root, Mon Apr 16 06:23:42 2007 UTC

232 int tval = 0, formula = 0; 232 int tval = 0, formula = 0;
233 233
234 while (tmp) 234 while (tmp)
235 { 235 {
236 tval = 0; 236 tval = 0;
237 strcpy (name, tmp->name); 237 assign (name, tmp->name);
238 if (tmp->title) 238 if (tmp->title)
239 sprintf (name, "%s %s", &tmp->name, &tmp->title); 239 sprintf (name, "%s %s", &tmp->name, &tmp->title);
240 tval = (strtoint (name) * (tmp->nrof ? tmp->nrof : 1)); 240 tval = (strtoint (name) * (tmp->nrof ? tmp->nrof : 1));
241#ifdef ALCHEMY_DEBUG 241#ifdef ALCHEMY_DEBUG
242 LOG (llevDebug, "Got ingredient %d %s(%d)\n", tmp->nrof ? tmp->nrof : 1, name, tval); 242 LOG (llevDebug, "Got ingredient %d %s(%d)\n", tmp->nrof ? tmp->nrof : 1, name, tval);
292 /* this should be passed to this fctn, not effiecent cpu use this way */ 292 /* this should be passed to this fctn, not effiecent cpu use this way */
293 int batches = abs (nbatches); 293 int batches = abs (nbatches);
294 294
295 295
296 /* is the cauldron the right type? */ 296 /* is the cauldron the right type? */
297 if (strcmp (rp->cauldron, cauldron->arch->name) != 0) 297 if (rp->cauldron != cauldron->arch->name)
298 { 298 {
299 new_draw_info (NDI_UNIQUE, 0, caster, "You are not using the proper" " facilities for this formula."); 299 new_draw_info (NDI_UNIQUE, 0, caster, "You are not using the proper" " facilities for this formula.");
300 return 0; 300 return 0;
301 } 301 }
302 302
310 { 310 {
311 object *tmp; 311 object *tmp;
312 312
313 for (tmp = caster->inv; tmp; tmp = tmp->below) 313 for (tmp = caster->inv; tmp; tmp = tmp->below)
314 { 314 {
315 if (tmp->type == FORCE && tmp->slaying && !strcmp (rp->keycode, tmp->slaying)) 315 if (tmp->type == FORCE && tmp->slaying && rp->keycode == tmp->slaying)
316 break; 316 break;
317 } 317 }
318 318
319 if (!tmp) 319 if (!tmp)
320 { /* failure--no code found */ 320 { /* failure--no code found */
448 { 448 {
449 size_t i; 449 size_t i;
450 450
451 for (i = 0; i < rp->arch_names; i++) 451 for (i = 0; i < rp->arch_names; i++)
452 { 452 {
453 if (strcmp (item->arch->name, rp->arch_name[i]) == 0) 453 if (item->arch->name == rp->arch_name[i])
454 { 454 {
455 *rp_arch_index = i; 455 *rp_arch_index = i;
456 break; 456 break;
457 } 457 }
458 } 458 }
459
459 if (i < rp->arch_names) 460 if (i < rp->arch_names)
460 break; 461 break;
461 } 462 }
462 463
463 /* failed, create a fresh object. Note no nrof>1 because that would 464 /* failed, create a fresh object. Note no nrof>1 because that would
510 511
511 if (rndm (0, 2)) 512 if (rndm (0, 2))
512 { /* slag created */ 513 { /* slag created */
513 object *tmp = cauldron->inv; 514 object *tmp = cauldron->inv;
514 int weight = 0; 515 int weight = 0;
515 uint16 material = M_STONE;
516 516
517 while (tmp)
518 { /* slag has coadded ingredient properties */
519 weight += tmp->weight;
520 if (!(material & tmp->material))
521 material |= tmp->material;
522 tmp = tmp->below;
523 }
524 tmp = get_archetype ("rock"); 517 tmp = get_archetype ("rock");
525 tmp->weight = weight; 518 tmp->weight = weight;
526 tmp->value = 0; 519 tmp->value = 0;
527 tmp->material = material;
528 tmp->materialname = "stone"; 520 tmp->materialname = "stone";
529 tmp->name = "slag"; 521 tmp->name = "slag";
530 tmp->name_pl = "slags"; 522 tmp->name_pl = "slags";
531 item = insert_ob_in_ob (tmp, cauldron); 523 item = insert_ob_in_ob (tmp, cauldron);
532 CLEAR_FLAG (tmp, FLAG_CAN_ROLL); 524 CLEAR_FLAG (tmp, FLAG_CAN_ROLL);
533 CLEAR_FLAG (tmp, FLAG_NO_PICK); 525 CLEAR_FLAG (tmp, FLAG_NO_PICK);
534 tmp->move_block = 0; 526 tmp->move_block = 0;
535 } 527 }
528
536 remove_contents (cauldron->inv, item); 529 remove_contents (cauldron->inv, item);
537 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s %s.", &cauldron->name, cauldron_sound ()); 530 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s %s.", &cauldron->name, cauldron_sound ());
538 return; 531 return;
539 } 532 }
540 else if (level < 40) 533 else if (level < 40)
770 * Thus the backfire is worse. Also, more ingredients 763 * Thus the backfire is worse. Also, more ingredients
771 * means we are attempting a more powerfull potion, 764 * means we are attempting a more powerfull potion,
772 * and thus the backfire will be worse. */ 765 * and thus the backfire will be worse. */
773 for (item = cauldron->inv; item; item = item->below) 766 for (item = cauldron->inv; item; item = item->below)
774 { 767 {
775 strcpy (name, item->name); 768 assign (name, item->name);
776 if (item->title) 769 if (item->title)
777 sprintf (name, "%s %s", &item->name, &item->title); 770 sprintf (name, "%s %s", &item->name, &item->title);
778 danger += (strtoint (name) / 1000) + 3; 771 danger += (strtoint (name) / 1000) + 3;
779 nrofi++; 772 nrofi++;
780 } 773 }
908 LOG (llevDebug, "looking for formula %d:\n", formula); 901 LOG (llevDebug, "looking for formula %d:\n", formula);
909#endif 902#endif
910 result = NULL; 903 result = NULL;
911 recipes_matching = 0; 904 recipes_matching = 0;
912 transmute_found = 0; 905 transmute_found = 0;
906
913 for (rp = fl->items; rp != NULL; rp = rp->next) 907 for (rp = fl->items; rp; rp = rp->next)
914 { 908 {
915 /* check if recipe matches at all */ 909 /* check if recipe matches at all */
916 if (formula % rp->index != 0) 910 if (formula % rp->index != 0)
917 { 911 {
918#ifdef EXTREME_ALCHEMY_DEBUG 912#ifdef EXTREME_ALCHEMY_DEBUG

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines