version 1.15 | | version 1.16 |
---|
| | |
/* | | /* |
* static char *rcsid_rune_c = | | * static char *rcsid_rune_c = |
* "$Id: rune.c,v 1.15 2001/04/24 04:51:00 mardahl Exp $"; | | * "$Id: rune.c,v 1.16 2001/05/10 06:58:15 mwedel Exp $"; |
*/ | | */ |
| | |
/* | | /* |
| | |
int write_rune(object *op,int dir,int inspell,int level,char *runename) { | | int write_rune(object *op,int dir,int inspell,int level,char *runename) { |
object *tmp; | | object *tmp; |
archetype *at=NULL; | | archetype *at=NULL; |
char *buf=(char *)malloc(sizeof(char) * 40); | | char buf[MAX_BUF]; |
| | |
int nx,ny; | | int nx,ny; |
| | |
| | |
/* next it attempts to look up a rune_archetype for this spell | | /* next it attempts to look up a rune_archetype for this spell |
by doing some string manipulations */ | | by doing some string manipulations */ |
if(!at) { | | if(!at) { |
char buf[MAX_BUF]; | | |
char insp[MAX_BUF]; | | char insp[MAX_BUF]; |
int i; | | int i; |
strcpy(insp,spells[inspell].name); | | strcpy(insp,spells[inspell].name); |
| | |
tmp->msg=add_string(buf); | | tmp->msg=add_string(buf); |
at=NULL; | | at=NULL; |
| | |
/* the only circumstance in which we remove buf, otherwise we need it.*/ | | |
} else if (level!=-2 && (at=find_archetype(runename))!=NULL) free(buf); | | /* the at=find_archetye(runename) is neccessary because |
/* the at=find_archetye(runename) was neccessary because | | * tmp=get_archetype returns a singulirity, not a null, |
tmp=get_archetype returns a singulirity, not a null, | | * when it cannot find the archetype. |
when it cannot find the archetype. */ | | * note: if some smartass |
/* note: if some smartass | | * cast rune of marking, and gives the exact name |
cast rune of marking, and gives the exact name | | * of a powerful rune, it won't do him any good, |
of a powerful rune, it won't do him any good, | | * because a rune of marking will have level 0 |
because a rune of marking will have level 0 | | * and will thus never detonate. |
and will thus never detonate. */ | | */ |
else { /* it's a rune of marking */ | | } else if (level==-2 || (at=find_archetype(runename))==NULL) { |
level=0; | | level=0; |
tmp=get_archetype("rune_mark"); /* this is a rune of marking */ | | tmp=get_archetype("rune_mark"); /* this is a rune of marking */ |
at=NULL; | | at=NULL; |