version 1.25 | | version 1.26 |
---|
| | |
/* | | /* |
* static char *rcsid_readable_c = | | * static char *rcsid_readable_c = |
* "$Id: readable.c,v 1.25 2005/10/28 19:08:53 akirschbaum Exp $"; | | * "$Id: readable.c,v 1.26 2005/10/31 21:23:00 akirschbaum Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
*/ | | */ |
| | |
void make_formula_book(object *book, int level) { | | void make_formula_book(object *book, int level) { |
char retbuf[BOOK_BUF], title[MAX_BUF], *dup = NULL; | | char retbuf[BOOK_BUF], title[MAX_BUF]; |
recipelist *fl; | | recipelist *fl; |
recipe *formula = NULL; | | recipe *formula = NULL; |
int chance; | | int chance; |
| | |
break; | | break; |
} | | } |
| | |
if (!formula) { | | if (!formula || formula->arch_names <= 0) { |
book->msg = add_string(" <indecipherable text>\n"); | | book->msg = add_string(" <indecipherable text>\n"); |
new_text_name(book, 4); | | new_text_name(book, 4); |
add_author(book,4); | | add_author(book,4); |
| | |
* of information on the booklevel and the spellevel | | * of information on the booklevel and the spellevel |
* of the formula. */ | | * of the formula. */ |
| | |
const char *op_name = NULL; | | const char *op_name = formula->arch_name[RANDOM()%formula->arch_names]; |
archetype *at; | | archetype *at; |
int nindex = nstrtok (formula->arch_name, ","); | | |
| | |
/* preamble */ | | /* preamble */ |
sprintf(retbuf, "Herein is described a project using %s: \n", | | sprintf(retbuf, "Herein is described a project using %s: \n", |
formula->skill?formula->skill:"an unknown skill"); | | formula->skill?formula->skill:"an unknown skill"); |
| | |
/* construct name of object to be made */ | | |
if (nindex > 1) | | |
{ | | |
int rnum = RANDOM () % nindex; | | |
dup = strdup_local(formula->arch_name); | | |
op_name = strtok (dup, ","); | | |
while (rnum) | | |
{ | | |
op_name = strtok (NULL, ","); | | |
rnum--; | | |
} | | |
} | | |
else | | |
op_name = formula->arch_name; | | |
| | |
if ((at = find_archetype (op_name)) != (archetype *) NULL) | | if ((at = find_archetype (op_name)) != (archetype *) NULL) |
op_name = at->clone.name; | | op_name = at->clone.name; |
else | | else |
| | |
if (book->msg) free_string(book->msg); | | if (book->msg) free_string(book->msg); |
book->msg = add_string(retbuf); | | book->msg = add_string(retbuf); |
} | | } |
free(dup); | | |
} | | } |
| | |
| | |