version 1.106 | | version 1.107 |
---|
| | |
/* | | /* |
* static char *rcsid_spell_util_c = | | * static char *rcsid_spell_util_c = |
* "$Id: spell_util.c,v 1.106 2006/06/05 06:28:56 mwedel Exp $"; | | * "$Id: spell_util.c,v 1.107 2006/07/25 16:23:31 gros Exp $"; |
*/ | | */ |
| | |
| | |
| | |
* we then make the owner of this object the target. | | * we then make the owner of this object the target. |
* The owner could very well be no where near op. | | * The owner could very well be no where near op. |
*/ | | */ |
if(op->type!=PLAYER && op->type!=RUNE) { | | if(op->type!=PLAYER && op->type!=RUNE) |
| | { |
tmp=get_owner(op); | | tmp=get_owner(op); |
/* If the owner does not exist, or is not a monster, than apply the spell | | /* If the owner does not exist, or is not a monster, than apply the spell |
* to the caster. | | * to the caster. |
*/ | | */ |
if(!tmp || !QUERY_FLAG(tmp,FLAG_MONSTER)) tmp=op; | | if(!tmp || !QUERY_FLAG(tmp,FLAG_MONSTER)) tmp=op; |
} | | } |
else { | | else |
| | { |
m = op->map; | | m = op->map; |
x = op->x+freearr_x[dir]; | | x = op->x+freearr_x[dir]; |
y = op->y+freearr_y[dir]; | | y = op->y+freearr_y[dir]; |
| | |
| | |
if (mflags & P_OUT_OF_MAP) | | if (mflags & P_OUT_OF_MAP) |
tmp=NULL; | | tmp=NULL; |
else { | | else |
| | { |
for(tmp=get_map_ob(m, x, y); tmp!=NULL; tmp=tmp->above) | | for(tmp=get_map_ob(m, x, y); tmp!=NULL; tmp=tmp->above) |
| | { |
if(tmp->type==PLAYER) | | if(tmp->type==PLAYER) |
break; | | break; |
} | | } |
} | | } |
| | } |
/* didn't find a player there, look in current square for a player */ | | /* didn't find a player there, look in current square for a player */ |
if(tmp==NULL) | | if(tmp==NULL) |
for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) | | for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) |
| | { |
if(tmp->type==PLAYER) | | if(tmp->type==PLAYER) |
break; | | break; |
| | /* Don't forget to browse inside transports ! - gros 2006/07/25 */ |
| | if(tmp->type==TRANSPORT) |
| | { |
| | object* inv; |
| | for (inv=tmp->inv; inv; inv=inv->below) |
| | { |
| | if (inv->type == PLAYER) |
| | { |
| | return inv; |
| | } |
| | } |
| | } |
| | } |
return tmp; | | return tmp; |
} | | } |
| | |