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.23 by elmex, Wed Dec 20 02:15:49 2006 UTC vs.
Revision 1.27 by root, Mon Dec 25 11:25:50 2006 UTC

441{ 441{
442 object *op; 442 object *op;
443 443
444 if (OUT_OF_REAL_MAP (m, x, y)) 444 if (OUT_OF_REAL_MAP (m, x, y))
445 return 0; 445 return 0;
446 for (op = get_map_ob (m, x, y); op != NULL; op = op->above) 446 for (op = GET_MAP_OB (m, x, y); op != NULL; op = op->above)
447 if (QUERY_FLAG (op, FLAG_REFL_SPELL) 447 if (QUERY_FLAG (op, FLAG_REFL_SPELL)
448 && (!QUERY_FLAG (op, FLAG_ALIVE) 448 && (!QUERY_FLAG (op, FLAG_ALIVE)
449 || sp_op->type == LIGHTNING // XXX: elmex: why is LIGHTNING special cased here?
450 // most spells use subtypes for bolts today...
451 || (rndm (0, 99)) < 90 - (sp_op->level / 10))) 449 || (rndm (0, 99)) < 90 - (sp_op->level / 10)))
452 return 1; 450 return 1;
453 451
454 return 0; 452 return 0;
455} 453}
507 return 0; 505 return 0;
508 506
509 if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (mp, x, y))) 507 if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (mp, x, y)))
510 return 0; 508 return 0;
511 509
512 for (tmp = get_map_ob (mp, x, y); tmp != NULL; tmp = tmp->above) 510 for (tmp = GET_MAP_OB (mp, x, y); tmp != NULL; tmp = tmp->above)
513 { 511 {
514 /* If there is a counterspell on the space, and this 512 /* If there is a counterspell on the space, and this
515 * object is using magic, don't progress. I believe we could 513 * object is using magic, don't progress. I believe we could
516 * leave this out and let in progress, and other areas of the code 514 * leave this out and let in progress, and other areas of the code
517 * will then remove it, but that would seem to to use more 515 * will then remove it, but that would seem to to use more
696 y = op->y + freearr_y[dir]; 694 y = op->y + freearr_y[dir];
697 695
698 mflags = get_map_flags (m, &m, x, y, &x, &y); 696 mflags = get_map_flags (m, &m, x, y, &x, &y);
699 697
700 if (mflags & P_OUT_OF_MAP) 698 if (mflags & P_OUT_OF_MAP)
701 tmp = NULL; 699 tmp = 0;
702 else 700 else
703 { 701 tmp = m->at (x, y).player ();
704 for (tmp = get_map_ob (m, x, y); tmp != NULL; tmp = tmp->above)
705 if (tmp->type == PLAYER)
706 break;
707 }
708 } 702 }
703
709 /* didn't find a player there, look in current square for a player */ 704 /* didn't find a player there, look in current square for a player */
710 if (tmp == NULL) 705 if (!tmp)
711 for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 706 tmp = op->ms ().player ();
712 {
713 if (tmp->type == PLAYER)
714 break;
715 }
716 707
717 return tmp; 708 return tmp;
718} 709}
719 710
720 711
752 mp = m; 743 mp = m;
753 mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny); 744 mflags = get_map_flags (m, &mp, nx, ny, &nx, &ny);
754 if (mflags & (P_OUT_OF_MAP | P_BLOCKSVIEW)) 745 if (mflags & (P_OUT_OF_MAP | P_BLOCKSVIEW))
755 continue; 746 continue;
756 747
757 tmp = get_map_ob (mp, nx, ny); 748 tmp = GET_MAP_OB (mp, nx, ny);
758 749
759 while (tmp != NULL && (((owner_type == PLAYER && 750 while (tmp != NULL && (((owner_type == PLAYER &&
760 !QUERY_FLAG (tmp, FLAG_MONSTER) && !QUERY_FLAG (tmp, FLAG_GENERATOR)) || 751 !QUERY_FLAG (tmp, FLAG_MONSTER) && !QUERY_FLAG (tmp, FLAG_GENERATOR)) ||
761 (owner_type != PLAYER && tmp->type != PLAYER)) || (tmp == exclude || (tmp->head && tmp->head == exclude)))) 752 (owner_type != PLAYER && tmp->type != PLAYER)) || (tmp == exclude || (tmp->head && tmp->head == exclude))))
762 tmp = tmp->above; 753 tmp = tmp->above;
1070 if (caster->contr->party == NULL) 1061 if (caster->contr->party == NULL)
1071 { 1062 {
1072 spell->remove (); 1063 spell->remove ();
1073 return success; 1064 return success;
1074 } 1065 }
1075 for (pl = first_player; pl != NULL; pl = pl->next) 1066 for_all_players (pl)
1076 if ((pl->ob->contr->party == caster->contr->party) && (on_same_map (pl->ob, caster))) 1067 if ((pl->ob->contr->party == caster->contr->party) && (on_same_map (pl->ob, caster)))
1077 { 1068 {
1078 cast_spell (pl->ob, caster, pl->ob->facing, spell, stringarg); 1069 cast_spell (pl->ob, caster, pl->ob->facing, spell, stringarg);
1079 } 1070 }
1080 spell->remove (); 1071 spell->remove ();

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines