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.37 by elmex, Fri Apr 3 10:01:31 2009 UTC vs.
Revision 1.38 by sf-marcmagus, Fri Oct 9 22:46:39 2009 UTC

127 rp = find_recipe (fl, formula, cauldron->inv); 127 rp = find_recipe (fl, formula, cauldron->inv);
128 if (rp != NULL) 128 if (rp != NULL)
129 { 129 {
130#ifdef ALCHEMY_DEBUG 130#ifdef ALCHEMY_DEBUG
131 if (strcmp (rp->title, "NONE")) 131 if (strcmp (rp->title, "NONE"))
132 LOG (llevDebug, "WIZ got formula: %s of %s\n", rp->arch_name[0], rp->title); 132 LOG (llevDebug, "WIZ got formula: %s of %s\n", rp->arch_name[0], &rp->title);
133 else 133 else
134 LOG (llevDebug, "WIZ got formula: %s (nbatches:%d)\n", rp->arch_name[0], formula / rp->index); 134 LOG (llevDebug, "WIZ got formula: %s (nbatches:%d)\n", rp->arch_name[0], formula / rp->index);
135#endif 135#endif
136 attempt_recipe (caster, cauldron, ability, rp, formula / rp->index); 136 attempt_recipe (caster, cauldron, ability, rp, formula / rp->index);
137 } 137 }
252 number++; 252 number++;
253 o_number++; 253 o_number++;
254 tmp = tmp->below; 254 tmp = tmp->below;
255 } 255 }
256#ifdef ALCHEMY_DEBUG 256#ifdef ALCHEMY_DEBUG
257 LOG (llevDebug, "numb_ob_inside(%s): found %d ingredients\n", op->name, o_number); 257 LOG (llevDebug, "numb_ob_inside(%s): found %d ingredients\n", &op->name, o_number);
258#endif 258#endif
259 return o_number; 259 return o_number;
260} 260}
261 261
262/** 262/**
303 } 303 }
304 } 304 }
305 305
306#ifdef EXTREME_ALCHEMY_DEBUG 306#ifdef EXTREME_ALCHEMY_DEBUG
307 LOG (llevDebug, "attempt_recipe(): got %d nbatches\n", nbatches); 307 LOG (llevDebug, "attempt_recipe(): got %d nbatches\n", nbatches);
308 LOG (llevDebug, "attempt_recipe(): using recipe %s\n", rp->title ? rp->title : "unknown"); 308 LOG (llevDebug, "attempt_recipe(): using recipe %s\n", *rp->title ? &rp->title : "unknown");
309#endif 309#endif
310 310
311 if ((item = make_item_from_recipe (cauldron, rp)) != NULL) 311 if ((item = make_item_from_recipe (cauldron, rp)) != NULL)
312 { 312 {
313 remove_contents (cauldron->inv, item); 313 remove_contents (cauldron->inv, item);
442 442
443 /* failed, create a fresh object. Note no nrof>1 because that would 443 /* failed, create a fresh object. Note no nrof>1 because that would
444 * allow players to create massive amounts of artifacts easily */ 444 * allow players to create massive amounts of artifacts easily */
445 if (create_item && (!prod_item || prod_item->nrof > 1)) 445 if (create_item && (!prod_item || prod_item->nrof > 1))
446 { 446 {
447#ifdef ALCHEMY_DEBUG
448 LOG (llevDebug, "creating a new item.\n");
449 if (prod_item != NULL)
450 {
451 LOG (llevDebug, " had item: arch %s(nrof:%d)\n",
452 &prod_item->arch->archname, prod_item->nrof);
453 }
454#endif
447 *rp_arch_index = rndm (rp->arch_names); 455 *rp_arch_index = rndm (rp->arch_names);
448 prod_item = get_archetype (rp->arch_name[*rp_arch_index]); 456 prod_item = get_archetype (rp->arch_name[*rp_arch_index]);
449 } 457 }
450 458
451#ifdef ALCHEMY_DEBUG 459#ifdef ALCHEMY_DEBUG
452 LOG (llevDebug, "recipe calls for%stransmution.\n", rp->transmute ? " " : " no "); 460 LOG (llevDebug, "recipe calls for%stransmution.\n", rp->transmute ? " " : " no ");
453 if (prod_item != NULL) 461 if (prod_item != NULL)
454 { 462 {
455 LOG (llevDebug, " find_transmutable_ob(): returns arch %s(sp:%d)\n", 463 LOG (llevDebug, " find_transmutable_ob(): returns arch %s(sp:%d)\n",
456 prod_item->arch->name, prod_item->stats.sp); 464 &prod_item->arch->archname, prod_item->stats.sp);
457 } 465 }
458#endif 466#endif
459 467
460 return prod_item; 468 return prod_item;
461} 469}
881 { 889 {
882 /* check if recipe matches at all */ 890 /* check if recipe matches at all */
883 if (formula % rp->index != 0) 891 if (formula % rp->index != 0)
884 { 892 {
885#ifdef EXTREME_ALCHEMY_DEBUG 893#ifdef EXTREME_ALCHEMY_DEBUG
886 LOG (llevDebug, " formula %s of %s (%d) does not match\n", rp->arch_name[0], rp->title, rp->index); 894 LOG (llevDebug, " formula %s of %s (%d) does not match\n", rp->arch_name[0], &rp->title, rp->index);
887#endif 895#endif
888 continue; 896 continue;
889 } 897 }
890 898
891 if (rp->transmute && find_transmution_ob (ingredients, rp, &rp_arch_index, 0) != NULL) 899 if (rp->transmute && find_transmution_ob (ingredients, rp, &rp_arch_index, 0) != NULL)
892 { 900 {
893#ifdef EXTREME_ALCHEMY_DEBUG 901#ifdef EXTREME_ALCHEMY_DEBUG
894 LOG (llevDebug, " formula %s of %s (%d) is a matching transmuting formula\n", rp->arch_name[rp_arch_index], rp->title, rp->index); 902 LOG (llevDebug, " formula %s of %s (%d) is a matching transmuting formula\n", rp->arch_name[rp_arch_index], &rp->title, rp->index);
895#endif 903#endif
896 /* transmution recipe with matching base ingredient */ 904 /* transmution recipe with matching base ingredient */
897 if (!transmute_found) 905 if (!transmute_found)
898 { 906 {
899 transmute_found = 1; 907 transmute_found = 1;
901 } 909 }
902 } 910 }
903 else if (transmute_found) 911 else if (transmute_found)
904 { 912 {
905#ifdef EXTREME_ALCHEMY_DEBUG 913#ifdef EXTREME_ALCHEMY_DEBUG
906 LOG (llevDebug, " formula %s of %s (%d) matches but is not a matching transmuting formula\n", rp->arch_name[0], rp->title, 914 LOG (llevDebug, " formula %s of %s (%d) matches but is not a matching transmuting formula\n", rp->arch_name[0], &rp->title,
907 rp->index); 915 rp->index);
908#endif 916#endif
909 /* "normal" recipe found after previous transmution recipe => ignore this recipe */ 917 /* "normal" recipe found after previous transmution recipe => ignore this recipe */
910 continue; 918 continue;
911 } 919 }
912#ifdef EXTREME_ALCHEMY_DEBUG 920#ifdef EXTREME_ALCHEMY_DEBUG
913 else 921 else
914 { 922 {
915 LOG (llevDebug, " formula %s of %s (%d) matches\n", rp->arch_name[0], rp->title, rp->index); 923 LOG (llevDebug, " formula %s of %s (%d) matches\n", rp->arch_name[0], &rp->title, rp->index);
916 } 924 }
917#endif 925#endif
918 926
919 if (rndm (0, recipes_matching) == 0) 927 if (rndm (0, recipes_matching) == 0)
920 result = rp; 928 result = rp;
930 return NULL; 938 return NULL;
931 } 939 }
932 940
933#ifdef ALCHEMY_DEBUG 941#ifdef ALCHEMY_DEBUG
934 if (strcmp (result->title, "NONE") != 0) 942 if (strcmp (result->title, "NONE") != 0)
935 LOG (llevDebug, "got formula: %s of %s (nbatches:%d)\n", result->arch_name[0], result->title, formula / result->index); 943 LOG (llevDebug, "got formula: %s of %s (nbatches:%d)\n", result->arch_name[0], &result->title, formula / result->index);
936 else 944 else
937 LOG (llevDebug, "got formula: %s (nbatches:%d)\n", result->arch_name[0], formula / result->index); 945 LOG (llevDebug, "got formula: %s (nbatches:%d)\n", result->arch_name[0], formula / result->index);
938#endif 946#endif
939 return result; 947 return result;
940} 948}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines