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.13 by root, Tue Sep 12 17:23:02 2006 UTC vs.
Revision 1.17 by root, Sat Sep 16 22:24:13 2006 UTC

16 16
17 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 20
21 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
22*/ 22*/
23 23
24 24
25#include <global.h> 25#include <global.h>
26#include <spells.h> 26#include <spells.h>
119 } 119 }
120 120
121 i = 0; 121 i = 0;
122 while (spell_mapping[i]) 122 while (spell_mapping[i])
123 { 123 {
124 if (!find_archetype (spell_mapping[i])) 124 if (!archetype::find (spell_mapping[i]))
125 { 125 {
126 LOG (llevError, "Unable to find spell mapping %s (%i)\n", spell_mapping[i], i); 126 LOG (llevError, "Unable to find spell mapping %s (%i)\n", spell_mapping[i], i);
127 } 127 }
128 i++; 128 i++;
129 } 129 }
153/* pretty basic function - basically just takes 153/* pretty basic function - basically just takes
154 * an object, sets the x,y, and calls insert_ob_in_map 154 * an object, sets the x,y, and calls insert_ob_in_map
155 */ 155 */
156 156
157void 157void
158spell_effect (object *spob, int x, int y, mapstruct *map, object *originator) 158spell_effect (object *spob, int x, int y, maptile *map, object *originator)
159{ 159{
160 160
161 if (spob->other_arch != NULL) 161 if (spob->other_arch != NULL)
162 { 162 {
163 object *effect = arch_to_object (spob->other_arch); 163 object *effect = arch_to_object (spob->other_arch);
444 * reflect_spell fails.) 444 * reflect_spell fails.)
445 * Caller should be sure it passes us valid map coordinates 445 * Caller should be sure it passes us valid map coordinates
446 * eg, updated for tiled maps. 446 * eg, updated for tiled maps.
447 */ 447 */
448int 448int
449reflwall (mapstruct *m, int x, int y, object *sp_op) 449reflwall (maptile *m, int x, int y, object *sp_op)
450{ 450{
451 object *op; 451 object *op;
452 452
453 if (OUT_OF_REAL_MAP (m, x, y)) 453 if (OUT_OF_REAL_MAP (m, x, y))
454 return 0; 454 return 0;
468 * in. 468 * in.
469 */ 469 */
470int 470int
471cast_create_obj (object *op, object *caster, object *new_op, int dir) 471cast_create_obj (object *op, object *caster, object *new_op, int dir)
472{ 472{
473 mapstruct *m; 473 maptile *m;
474 sint16 sx, sy; 474 sint16 sx, sy;
475 475
476 if (dir && 476 if (dir &&
477 ((get_map_flags (op->map, &m, op->x + freearr_x[dir], op->y + freearr_y[dir], &sx, &sy) & P_OUT_OF_MAP) || 477 ((get_map_flags (op->map, &m, op->x + freearr_x[dir], op->y + freearr_y[dir], &sx, &sy) & P_OUT_OF_MAP) ||
478 OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy)))) 478 OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))))
498 * does not have AT_MAGIC, then counterwalls do not effect the spell. 498 * does not have AT_MAGIC, then counterwalls do not effect the spell.
499 * 499 *
500 */ 500 */
501 501
502int 502int
503ok_to_put_more (mapstruct *m, sint16 x, sint16 y, object *op, int immune_stop) 503ok_to_put_more (maptile *m, sint16 x, sint16 y, object *op, int immune_stop)
504{ 504{
505 object *tmp; 505 object *tmp;
506 int mflags; 506 int mflags;
507 mapstruct *mp; 507 maptile *mp;
508 508
509 mp = m; 509 mp = m;
510 mflags = get_map_flags (m, &mp, x, y, &x, &y); 510 mflags = get_map_flags (m, &mp, x, y, &x, &y);
511 511
512 if (mflags & P_OUT_OF_MAP) 512 if (mflags & P_OUT_OF_MAP)
578int 578int
579fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell) 579fire_arch_from_position (object *op, object *caster, sint16 x, sint16 y, int dir, object *spell)
580{ 580{
581 object *tmp; 581 object *tmp;
582 int mflags; 582 int mflags;
583 mapstruct *m; 583 maptile *m;
584 584
585 if (spell->other_arch == NULL) 585 if (spell->other_arch == NULL)
586 return 0; 586 return 0;
587 587
588 m = op->map; 588 m = op->map;
678 678
679object * 679object *
680find_target_for_friendly_spell (object *op, int dir) 680find_target_for_friendly_spell (object *op, int dir)
681{ 681{
682 object *tmp; 682 object *tmp;
683 mapstruct *m; 683 maptile *m;
684 sint16 x, y; 684 sint16 x, y;
685 int mflags; 685 int mflags;
686 686
687 /* I don't really get this block - if op isn't a player or rune, 687 /* I don't really get this block - if op isn't a player or rune,
688 * we then make the owner of this object the target. 688 * we then make the owner of this object the target.
738 * any, otherwise -1. 738 * any, otherwise -1.
739 * note that exclude can be NULL, in which case all bets are off. 739 * note that exclude can be NULL, in which case all bets are off.
740 */ 740 */
741 741
742int 742int
743spell_find_dir (mapstruct *m, int x, int y, object *exclude) 743spell_find_dir (maptile *m, int x, int y, object *exclude)
744{ 744{
745 int i, max = SIZEOFFREE; 745 int i, max = SIZEOFFREE;
746 sint16 nx, ny; 746 sint16 nx, ny;
747 int owner_type = 0, mflags; 747 int owner_type = 0, mflags;
748 object *tmp; 748 object *tmp;
749 mapstruct *mp; 749 maptile *mp;
750 750
751 if (exclude && exclude->head) 751 if (exclude && exclude->head)
752 exclude = exclude->head; 752 exclude = exclude->head;
753 if (exclude && exclude->type) 753 if (exclude && exclude->type)
754 owner_type = exclude->type; 754 owner_type = exclude->type;
789 archetype *at; 789 archetype *at;
790 int dir; 790 int dir;
791 791
792 /* Handle cases where we are passed a bogus mosntername */ 792 /* Handle cases where we are passed a bogus mosntername */
793 793
794 if ((at = find_archetype (monstername)) == NULL) 794 if ((at = archetype::find (monstername)) == NULL)
795 return; 795 return;
796 796
797 /* find a free square nearby 797 /* find a free square nearby
798 * first we check the closest square for free squares 798 * first we check the closest square for free squares
799 */ 799 */
1688 break; 1688 break;
1689 1689
1690 case SP_MAGIC_MISSILE: 1690 case SP_MAGIC_MISSILE:
1691 if (QUERY_FLAG (victim, FLAG_ALIVE)) 1691 if (QUERY_FLAG (victim, FLAG_ALIVE))
1692 { 1692 {
1693 tag_t spell_tag = spell->count;
1694
1695 hit_player (victim, spell->stats.dam, spell, spell->attacktype, 1); 1693 hit_player (victim, spell->stats.dam, spell, spell->attacktype, 1);
1696 if (!was_destroyed (spell, spell_tag)) 1694
1695 if (!spell->destroyed ())
1697 { 1696 {
1698 remove_ob (spell); 1697 remove_ob (spell);
1699 free_object (spell); 1698 free_object (spell);
1700 } 1699 }
1701 } 1700 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines