version 1.48 | | version 1.49 |
---|
| | |
/* | | /* |
* static char *rcsid_c_wiz_c = | | * static char *rcsid_c_wiz_c = |
* "$Id: c_wiz.c,v 1.48 2004/06/16 07:09:44 mwedel Exp $"; | | * "$Id: c_wiz.c,v 1.49 2004/06/18 07:45:29 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
object *tmp=NULL; | | object *tmp=NULL; |
int nrof,i, magic, set_magic = 0, set_nrof = 0, gotquote, gotspace; | | int nrof,i, magic, set_magic = 0, set_nrof = 0, gotquote, gotspace; |
char buf[MAX_BUF], *cp, *bp = buf, *bp2, *bp3, *bp4, *obp; | | char buf[MAX_BUF], *cp, *bp = buf, *bp2, *bp3, *bp4, *obp; |
archetype *at; | | archetype *at, *at_spell=NULL; |
artifact *art=NULL; | | artifact *art=NULL; |
| | |
if (!op) | | if (!op) |
| | |
} | | } |
| | |
if (cp) { | | if (cp) { |
| | /* Try to find a spell object for this. Note have to use |
| | * find_archetype, and note find_archetype_by_object_name, |
| | * because teh spaces are nulled out above. |
| | */ |
| | if ((at_spell=find_archetype(cp))==NULL || |
| | at_spell->clone.type != SPELL) { |
| | |
if (find_artifactlist(at->clone.type)==NULL) { | | if (find_artifactlist(at->clone.type)==NULL) { |
new_draw_info_format(NDI_UNIQUE, 0, op, | | new_draw_info_format(NDI_UNIQUE, 0, op, |
"No artifact list for type %d\n", at->clone.type); | | "No artifact list for type %d\n", at->clone.type); |
| | |
} | | } |
LOG(llevDebug, "%s creates: (%d) (%d) (%s) of (%s)\n", op->name, | | LOG(llevDebug, "%s creates: (%d) (%d) (%s) of (%s)\n", op->name, |
set_nrof ? nrof : 0, set_magic ? magic : 0 , bp, cp); | | set_nrof ? nrof : 0, set_magic ? magic : 0 , bp, cp); |
| | } |
} /* if cp */ | | } /* if cp */ |
| | |
if(at->clone.nrof) { | | if(at->clone.nrof) { |
| | |
SET_FLAG(tmp, FLAG_IDENTIFIED); | | SET_FLAG(tmp, FLAG_IDENTIFIED); |
CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL); | | CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL); |
} | | } |
| | if (at_spell) |
| | insert_ob_in_ob(arch_to_object(at_spell), tmp); |
| | |
while (*bp2) { | | while (*bp2) { |
/* find the first quote */ | | /* find the first quote */ |
for (bp3=bp2, gotquote=0, gotspace=0; *bp3 && gotspace < 2; bp3++) { | | for (bp3=bp2, gotquote=0, gotspace=0; *bp3 && gotspace < 2; bp3++) { |
| | |
SET_FLAG(tmp, FLAG_IDENTIFIED); | | SET_FLAG(tmp, FLAG_IDENTIFIED); |
CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL); | | CLEAR_FLAG(tmp, FLAG_KNOWN_MAGICAL); |
} | | } |
| | if (at_spell) |
| | insert_ob_in_ob(arch_to_object(at_spell), tmp); |
| | /* Note that I believe this entire block below (for finding the variables) |
| | * is completely broken here. This is because it modifies the string it |
| | * works on. Thus, for the first object it creates, it would work OK, |
| | * but for the second, third, etc, it simply won't work because nulls have |
| | * been inserted. |
| | */ |
while (*bp2) { | | while (*bp2) { |
/* find the first quote */ | | /* find the first quote */ |
for (bp3=bp2, gotquote=0, gotspace=0; *bp3 && gotspace < 2; | | for (bp3=bp2, gotquote=0, gotspace=0; *bp3 && gotspace < 2; |
| | |
insert_ob_in_map(head, op->map, op, 0); | | insert_ob_in_map(head, op->map, op, 0); |
else | | else |
head = insert_ob_in_ob(head, op); | | head = insert_ob_in_ob(head, op); |
if (at->clone.randomitems!=NULL) | | if (at->clone.randomitems!=NULL && !at_spell) |
create_treasure(at->clone.randomitems, head, GT_APPLY, | | create_treasure(at->clone.randomitems, head, GT_APPLY, |
op->map->difficulty, 0); | | op->map->difficulty, 0); |
esrv_send_item(op, head); | | esrv_send_item(op, head); |