--- deliantra/server/server/spell_attack.C 2009/02/21 06:30:34 1.82 +++ deliantra/server/server/spell_attack.C 2009/11/06 12:49:19 1.89 @@ -1,22 +1,23 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * Copyright (©) 2002-2003,2007 Mark Wedel & Crossfire Development Team * Copyright (©) 1992,2007 Frank Tore Johansen * - * Deliantra is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. + * Deliantra is free software: you can redistribute it and/or modify it under + * the terms of the Affero GNU General Public License as published by the + * Free Software Foundation, either version 3 of the License, or (at your + * option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * You should have received a copy of the Affero GNU General Public License + * and the GNU General Public License along with this program. If not, see + * . * * The authors can be reached via e-mail to */ @@ -38,7 +39,7 @@ * but moved here so it could be applied to bolts too * op is the spell object. */ -void +static void check_spell_knockback (object *op) { int weight_move; @@ -390,7 +391,7 @@ * poison cloud ball, etc. op is the object to * explode. */ -void +static void explode_bullet (object *op) { object *tmp, *owner; @@ -547,10 +548,6 @@ void move_bullet (object *op) { - sint16 new_x, new_y; - int mflags; - maptile *m; - #if 0 /* We need a better general purpose way to do this */ @@ -575,18 +572,20 @@ return; } - new_x = op->x + DIRX (op); - new_y = op->y + DIRY (op); - m = op->map; - mflags = get_map_flags (m, &m, new_x, new_y, &new_x, &new_y); + mapxy pos (op); + pos.move (op->direction); - if (mflags & P_OUT_OF_MAP) + if (!pos.normalise ()) { op->destroy (); return; } - if (!op->direction || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))) + mapspace &ms = pos.ms (); + + ms.update (); + + if (!op->direction || OB_TYPE_MOVE_BLOCK (op, ms.move_block)) { if (op->other_arch) explode_bullet (op); @@ -596,7 +595,7 @@ return; } - if (!(op = m->insert (op, new_x, new_y, op))) + if (!(op = pos.insert (op, op))) return; if (reflwall (op->map, op->x, op->y, op)) @@ -690,7 +689,7 @@ *****************************************************************************/ /* drops an object based on what is in the cone's "other_arch" */ -void +static void cone_drop (object *op) { object *new_ob = arch_to_object (op->other_arch); @@ -830,14 +829,14 @@ for (i = range_min; i <= range_max; i++) { - sint16 x, y, d; + sint16 x, y; /* We can't use absdir here, because it never returns * 0. If this is a rune, we want to hit the person on top * of the trap (d==0). If it is not a rune, then we don't want * to hit that person. */ - d = dir ? absdir (dir + i) : 0; + int d = dir ? absdir (dir + i) : i; /* If it's not a rune, we don't want to blast the caster. * In that case, we have to see - if dir is specified, @@ -949,7 +948,7 @@ if (op->env) { - if (env->map == NULL) + if (!env->map) return; if (!(op = op->insert_at (env, op))) @@ -959,7 +958,7 @@ // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent bomb from exploding // on a safe map. I don't like this special casing, but it seems to be neccessary // as bombs can be carried. - if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) + if (op->ms ().flags () & P_SAFE) { op->destroy (); return; @@ -1910,12 +1909,13 @@ if (tmp->glow_radius) tmp->set_glow_radius ( - min (MAX_LIGHT_RADIUS, spell->range + SP_level_range_adjust (caster, spell))); + clamp (spell->range + SP_level_range_adjust (caster, spell), 1, MAX_LIGHT_RADIUS) + ); if (dir) m->insert (tmp, x, y, op); else - caster->outer_env ()->insert (tmp); + caster->outer_env_or_self ()->insert (tmp); return 1; }