ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_util.c
(Generate patch)

Comparing deliantra/server/server/spell_util.c (file contents):
Revision 1.8 by root, Fri May 12 13:36:51 2006 UTC vs.
Revision 1.9 by elmex, Wed Aug 2 17:17:13 2006 UTC

1/* 1/*
2 * static char *rcsid_spell_util_c = 2 * static char *rcsid_spell_util_c =
3 * "$Id: spell_util.c,v 1.8 2006/05/12 13:36:51 root Exp $"; 3 * "$Id: spell_util.c,v 1.9 2006/08/02 17:17:13 elmex Exp $";
4 */ 4 */
5 5
6 6
7/* 7/*
8 CrossFire, A Multiplayer game for X-windows 8 CrossFire, A Multiplayer game for X-windows
625 625
626 /* I don't really get this block - if op isn't a player or rune, 626 /* I don't really get this block - if op isn't a player or rune,
627 * we then make the owner of this object the target. 627 * we then make the owner of this object the target.
628 * The owner could very well be no where near op. 628 * The owner could very well be no where near op.
629 */ 629 */
630 if(op->type!=PLAYER && op->type!=RUNE) { 630 if(op->type!=PLAYER && op->type!=RUNE)
631 {
631 tmp=get_owner(op); 632 tmp=get_owner(op);
632 /* If the owner does not exist, or is not a monster, than apply the spell 633 /* If the owner does not exist, or is not a monster, than apply the spell
633 * to the caster. 634 * to the caster.
634 */ 635 */
635 if(!tmp || !QUERY_FLAG(tmp,FLAG_MONSTER)) tmp=op; 636 if(!tmp || !QUERY_FLAG(tmp,FLAG_MONSTER)) tmp=op;
636 } 637 }
637 else { 638 else
638 m = op->map; 639 {
640 m = op->map;
639 x = op->x+freearr_x[dir]; 641 x = op->x+freearr_x[dir];
640 y = op->y+freearr_y[dir]; 642 y = op->y+freearr_y[dir];
641 643
642 mflags = get_map_flags(m, &m, x, y, &x, &y); 644 mflags = get_map_flags(m, &m, x, y, &x, &y);
643 645
644 if (mflags & P_OUT_OF_MAP) 646 if (mflags & P_OUT_OF_MAP)
645 tmp=NULL; 647 tmp=NULL;
646 else { 648 else
649 {
647 for(tmp=get_map_ob(m, x, y); tmp!=NULL; tmp=tmp->above) 650 for(tmp=get_map_ob(m, x, y); tmp!=NULL; tmp=tmp->above)
648 if(tmp->type==PLAYER) 651 {
649 break; 652 if(tmp->type==PLAYER)
650 } 653 break;
654 }
655 }
651 } 656 }
652 /* didn't find a player there, look in current square for a player */ 657 /* didn't find a player there, look in current square for a player */
653 if(tmp==NULL) 658 if(tmp==NULL)
654 for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above) 659 for(tmp=get_map_ob(op->map,op->x,op->y);tmp!=NULL;tmp=tmp->above)
660 {
655 if(tmp->type==PLAYER) 661 if(tmp->type==PLAYER)
656 break; 662 break;
663 /* Don't forget to browse inside transports ! - gros 2006/07/25 */
664 if(tmp->type==TRANSPORT)
665 {
666 object* inv;
667 for (inv=tmp->inv; inv; inv=inv->below)
668 {
669 if (inv->type == PLAYER)
670 {
671 return inv;
672 }
673 }
674 }
675 }
657 return tmp; 676 return tmp;
658} 677}
659 678
660 679
661 680

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines