--- deliantra/server/server/spell_attack.C 2006/12/12 20:53:03 1.16 +++ deliantra/server/server/spell_attack.C 2006/12/12 21:39:57 1.17 @@ -142,8 +142,8 @@ return; /* OK, we made a fork */ - new_bolt = get_object (); - copy_object (tmp, new_bolt); + new_bolt = object::create (); + tmp->copy_to (new_bolt); /* reduce chances of subsequent forking */ new_bolt->stats.Dex -= 10; @@ -176,8 +176,7 @@ if (--(op->duration) < 0) { - op->remove (); - op->destroy (0); + op->destroy (); return; } @@ -252,8 +251,8 @@ } else { /* Create a copy of this object and put it ahead */ - tmp = get_object (); - copy_object (op, tmp); + tmp = object::create (); + op->copy_to (tmp); tmp->speed_left = -0.1; tmp->x += DIRX (tmp), tmp->y += DIRY (tmp); tmp = insert_ob_in_map (tmp, op->map, op, 0); @@ -322,23 +321,27 @@ mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); if (mflags & P_OUT_OF_MAP) { - tmp->destroy (0); + tmp->destroy (); return 0; } + if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (0); + tmp->destroy (); return 0; } + tmp->x = op->x; tmp->y = op->y; tmp->direction = absdir (tmp->direction + 4); tmp->map = op->map; } + if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)) != NULL) move_bolt (tmp); + return 1; } @@ -363,10 +366,10 @@ if (--(op->duration) < 0) { - op->remove (); - op->destroy (0); + op->destroy (); return; } + hit_map (op, 0, op->attacktype, 0); if (op->range > 0) @@ -382,8 +385,8 @@ */ if (ok_to_put_more (op->map, dx, dy, op, op->attacktype)) { - tmp = get_object (); - copy_object (op, tmp); + tmp = object::create (); + op->copy_to (tmp); tmp->state = 0; tmp->speed_left = -0.21; tmp->range--; @@ -409,8 +412,7 @@ if (op->other_arch == NULL) { LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); - op->remove (); - op->destroy (0); + op->destroy (); return; } @@ -422,10 +424,10 @@ if (env->map == NULL || out_of_map (env->map, env->x, env->y)) { LOG (llevError, "BUG: explode_bullet(): env out of map\n"); - op->remove (); - op->destroy (0); + op->destroy (); return; } + op->remove (); op->x = env->x; op->y = env->y; @@ -434,8 +436,7 @@ else if (out_of_map (op->map, op->x, op->y)) { LOG (llevError, "BUG: explode_bullet(): op out of map\n"); - op->remove (); - op->destroy (0); + op->destroy (); return; } @@ -444,8 +445,7 @@ // bad at the moment that might happen from this. if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) { - op->remove (); - op->destroy (0); + op->destroy (); return; } @@ -466,8 +466,7 @@ if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) { - op->remove (); - op->destroy (0); + op->destroy (); return; } @@ -507,8 +506,7 @@ /* remove the firebullet */ if (!op->destroyed ()) { - op->remove (); - op->destroy (0); + op->destroy (); } } @@ -551,8 +549,7 @@ { if (!QUERY_FLAG (op, FLAG_REMOVED)) { - op->remove (); - op->destroy (0); + op->destroy (); return; } } @@ -591,14 +588,10 @@ if (--op->range <= 0) { if (op->other_arch) - { - explode_bullet (op); - } + explode_bullet (op); else - { - op->remove (); - op->destroy (0); - } + op->destroy (); + return; } @@ -609,22 +602,17 @@ if (mflags & P_OUT_OF_MAP) { - op->remove (); - op->destroy (0); + op->destroy (); return; } if (!op->direction || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))) { if (op->other_arch) - { - explode_bullet (op); - } + explode_bullet (op); else - { - op->remove (); - op->destroy (0); - } + op->destroy (); + return; } @@ -697,25 +685,27 @@ mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); if (mflags & P_OUT_OF_MAP) { - tmp->destroy (0); + tmp->destroy (); return 0; } + if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) { if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) { - tmp->destroy (0); + tmp->destroy (); return 0; } + tmp->x = op->x; tmp->y = op->y; tmp->direction = absdir (tmp->direction + 4); tmp->map = op->map; } + if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)) != NULL) - { - check_bullet (tmp); - } + check_bullet (tmp); + return 1; } @@ -779,8 +769,7 @@ /* If no owner left, the spell dies out. */ if (get_owner (op) == NULL) { - op->remove (); - op->destroy (0); + op->destroy (); return; } #endif @@ -799,8 +788,7 @@ if ((op->duration--) < 0) { - op->remove (); - op->destroy (0); + op->destroy (); return; } /* Object has hit maximum range, so don't have it move @@ -819,9 +807,9 @@ if (ok_to_put_more (op->map, x, y, op, op->attacktype)) { - object *tmp = get_object (); + object *tmp = object::create (); - copy_object (op, tmp); + op->copy_to (tmp); tmp->x = x; tmp->y = y; @@ -1026,8 +1014,7 @@ // as bombs can be carried. if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) { - op->remove (); - op->destroy (0); + op->destroy (); return; } @@ -1231,7 +1218,7 @@ { new_draw_info_format (NDI_UNIQUE, 0, op, "The %s looks stronger!", query_name (target)); target->stats.hp = target->stats.maxhp * 2; - effect->destroy (0); + effect->destroy (); return 0; } } @@ -1272,8 +1259,7 @@ if (op->range-- <= 0) { - op->remove (); - op->destroy (0); + op->destroy (); return; } @@ -1284,8 +1270,7 @@ */ if (owner == NULL) { - op->remove (); - op->destroy (0); + op->destroy (); return; } #endif @@ -1302,7 +1287,7 @@ * we need to remove it if someone hasn't already done so. */ if (!op->destroyed ()) - op->destroy (0); + op->destroy (); return; } @@ -1311,7 +1296,7 @@ if (!op->direction || (mflags & P_OUT_OF_MAP)) { - op->destroy (0); + op->destroy (); return; } @@ -1876,10 +1861,10 @@ owner = get_owner (op); if (op->duration == 0 || owner == NULL) { - op->remove (); - op->destroy (0); + op->destroy (); return; } + op->duration--; basedir = op->direction; @@ -2201,7 +2186,7 @@ new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); - disease->destroy (0); /* don't need this one anymore */ + disease->destroy (); /* don't need this one anymore */ flash = get_archetype (ARCH_DETECT_MAGIC); flash->x = x; flash->y = y; @@ -2209,7 +2194,8 @@ insert_ob_in_map (flash, walk->map, op, 0); return 1; } - disease->destroy (0); + + disease->destroy (); } } /* if living creature */ } /* for range of spaces */