--- deliantra/server/common/recipe.C 2007/01/02 23:39:21 1.12 +++ deliantra/server/common/recipe.C 2007/02/08 03:09:31 1.17 @@ -153,7 +153,7 @@ while (*cp == ' ') /* Skip blanks */ cp++; - if (!strncmp (cp, "Object", 6)) + if (!strncmp (cp, "Object", 6) || !strncmp (cp, "object", 6)) { formula = get_empty_formula (); formula->title = strchr (cp, ' ') + 1; @@ -256,7 +256,7 @@ recipe *check, *formula; int numb = 1; - LOG (llevDebug, "Checking formulae lists..."); + LOG (llevDebug, "Checking formulae lists...\n"); for (fl = formulalist; fl != NULL; fl = fl->next) { @@ -375,7 +375,7 @@ } else { - if (!strcasecmp (t->item->clone.name, name)) + if (t->item && !strcasecmp (t->item->clone.name, name)) return t->item; } @@ -424,10 +424,12 @@ mult = 10 * mult + (*name - '0'); name++; } + if (mult > 0) name++; else mult = 1; + /* first, try to match the name of an archetype */ for (at = first_archetype; at != NULL; at = at->next) { @@ -441,6 +443,7 @@ if (!strcasecmp (at->clone.name, name)) return mult * at->clone.value; } + /* second, try to match an artifact ("arch of something") */ cp = strstr (name, " of "); if (cp != NULL) @@ -464,9 +467,10 @@ } } } + /* third, try to match a body part ("arch's something") */ cp = strstr (name, "'s "); - if (cp != NULL) + if (cp) { strcpy (part1, name); part1[cp - name] = '\0'; @@ -483,6 +487,7 @@ } } } + /* failed to find any matching items -- formula should be checked */ return -1; } @@ -652,7 +657,7 @@ /* now, randomly choose one */ if (number > 0) - roll = RANDOM () % number; + roll = rndm (number); fl = get_formulalist (1); while (roll && fl) @@ -685,7 +690,7 @@ if (fl->total_chance > 0) { - r = RANDOM () % fl->total_chance; + r = rndm (fl->total_chance); for (rp = fl->items; rp; rp = rp->next) { r -= rp->chance;