--- deliantra/server/server/spell_attack.C 2006/12/12 21:39:57 1.17 +++ deliantra/server/server/spell_attack.C 2006/12/22 16:34:00 1.22 @@ -59,7 +59,7 @@ /*LOG (llevDebug, "DEBUG: arch weighs %d and masses %d (%s,level %d)\n", op->weight,weight_move,op->name,op->level); */ } - for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) + for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) { int num_sections = 1; @@ -142,8 +142,7 @@ return; /* OK, we made a fork */ - new_bolt = object::create (); - tmp->copy_to (new_bolt); + new_bolt = tmp->clone (); /* reduce chances of subsequent forking */ new_bolt->stats.Dex -= 10; @@ -251,8 +250,8 @@ } else { /* Create a copy of this object and put it ahead */ - tmp = object::create (); - op->copy_to (tmp); + tmp = op->clone (); + tmp->speed_left = -0.1; tmp->x += DIRX (tmp), tmp->y += DIRY (tmp); tmp = insert_ob_in_map (tmp, op->map, op, 0); @@ -311,7 +310,7 @@ if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) SET_ANIMATION (tmp, dir); - set_owner (tmp, op); + tmp->set_owner (op); set_spell_skill (op, caster, spob, tmp); tmp->x = op->x + DIRX (tmp); @@ -385,8 +384,7 @@ */ if (ok_to_put_more (op->map, dx, dy, op, op->attacktype)) { - tmp = object::create (); - op->copy_to (tmp); + tmp = op->clone (); tmp->state = 0; tmp->speed_left = -0.21; tmp->range--; @@ -459,10 +457,10 @@ /* other_arch contains what this explodes into */ tmp = arch_to_object (op->other_arch); - copy_owner (tmp, op); + tmp->set_owner (op); tmp->skill = op->skill; - owner = get_owner (op); + owner = op->owner; if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) { @@ -540,7 +538,7 @@ if (!(mflags & P_IS_ALIVE)) return; - for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) + for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) { if (QUERY_FLAG (tmp, FLAG_ALIVE)) { @@ -675,7 +673,7 @@ if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) SET_ANIMATION (tmp, dir); - set_owner (tmp, op); + tmp->set_owner (op); set_spell_skill (op, caster, spob, tmp); tmp->x = op->x + freearr_x[dir]; @@ -728,7 +726,7 @@ new_ob->x = op->x; new_ob->y = op->y; new_ob->level = op->level; - set_owner (new_ob, op->owner); + new_ob->set_owner (op->owner); /* preserve skill ownership */ if (op->skill && op->skill != new_ob->skill) @@ -767,7 +765,7 @@ * when their cone dies when they die. */ /* If no owner left, the spell dies out. */ - if (get_owner (op) == NULL) + if (op->owner == NULL) { op->destroy (); return; @@ -807,9 +805,8 @@ if (ok_to_put_more (op->map, x, y, op, op->attacktype)) { - object *tmp = object::create (); + object *tmp = op->clone (); - op->copy_to (tmp); tmp->x = x; tmp->y = y; @@ -903,7 +900,7 @@ success = 1; tmp = arch_to_object (spell->other_arch); - set_owner (tmp, op); + tmp->set_owner (op); set_spell_skill (op, caster, spell, tmp); tmp->level = caster_level (caster, spell); tmp->x = sx; @@ -1035,7 +1032,7 @@ tmp->stats.dam = op->stats.dam; tmp->duration = op->duration; tmp->attacktype = op->attacktype; - copy_owner (tmp, op); + tmp->set_owner (op); if (op->skill && op->skill != tmp->skill) { tmp->skill = op->skill; @@ -1075,7 +1072,7 @@ tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); tmp->attacktype = spell->attacktype; - set_owner (tmp, op); + tmp->set_owner (op); set_spell_skill (op, caster, spell, tmp); tmp->x = dx; tmp->y = dy; @@ -1128,7 +1125,7 @@ if (mflags & P_IS_ALIVE) { - for (target = get_map_ob (mp, x, y); target; target = target->above) + for (target = GET_MAP_OB (mp, x, y); target; target = target->above) { if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER)) { @@ -1205,8 +1202,7 @@ effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell); /* casting death spells at undead isn't a good thing */ - if QUERY_FLAG - (target, FLAG_UNDEAD) + if (QUERY_FLAG (target, FLAG_UNDEAD)) { if (random_roll (0, 2, op, PREFER_LOW)) { @@ -1229,7 +1225,7 @@ effect->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); } - set_owner (effect, op); + effect->set_owner (op); set_spell_skill (op, caster, spell, effect); /* ok, tell it where to be, and insert! */ @@ -1263,7 +1259,7 @@ return; } - owner = get_owner (op); + owner = op->owner; #if 0 /* It'd make things nastier if this wasn't here - spells cast by * monster that are then killed would continue to survive @@ -1303,7 +1299,7 @@ op->x = new_x; op->y = new_y; op->map = m; - i = spell_find_dir (op->map, op->x, op->y, get_owner (op)); + i = spell_find_dir (op->map, op->x, op->y, op->owner); if (i > 0 && i != op->direction) { op->direction = i; @@ -1403,7 +1399,7 @@ continue; if (mflags & P_IS_ALIVE) { - for (tmp = get_map_ob (m, sx, sy); tmp; tmp = tmp->above) + for (tmp = GET_MAP_OB (m, sx, sy); tmp; tmp = tmp->above) { if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER) break; @@ -1536,7 +1532,7 @@ change_abil (tmp, force); /* Mostly to display any messages */ insert_ob_in_ob (force, tmp); - fix_player (tmp); + tmp->update_stats (); return 1; } @@ -1597,7 +1593,7 @@ if (!(mflags & P_IS_ALIVE)) continue; - for (tmp = get_map_ob (m, nx, ny); tmp; tmp = tmp->above) + for (tmp = GET_MAP_OB (m, nx, ny); tmp; tmp = tmp->above) if (QUERY_FLAG (tmp, FLAG_MONSTER)) break; @@ -1695,7 +1691,7 @@ Typical use case is charm, go somwhere, use aggravation to make hostile. This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ CLEAR_FLAG (head, FLAG_GENERATOR); - set_owner (head, op); + head->set_owner (op); set_spell_skill (op, caster, spell, head); add_friendly_object (head); head->attack_movement = PETMOVE; @@ -1733,7 +1729,7 @@ object *owner; maptile *m; - owner = get_owner (op); + owner = op->owner; /* the following logic makes sure that the ball doesn't move into a wall, * and makes sure that it will move along a wall to try and get at it's @@ -1822,7 +1818,7 @@ /* restore to the center location and damage */ op->stats.dam = dam_save; - i = spell_find_dir (op->map, op->x, op->y, get_owner (op)); + i = spell_find_dir (op->map, op->x, op->y, op->owner); if (i >= 0) { /* we have a preferred direction! */ @@ -1858,7 +1854,7 @@ int basedir; object *owner; - owner = get_owner (op); + owner = op->owner; if (op->duration == 0 || owner == NULL) { op->destroy (); @@ -1973,7 +1969,7 @@ tmp = get_archetype (SWARM_SPELL); tmp->x = op->x; tmp->y = op->y; - set_owner (tmp, op); /* needed so that if swarm elements kill, caster gets xp. */ + tmp->set_owner (op); /* needed so that if swarm elements kill, caster gets xp. */ set_spell_skill (op, caster, spell, tmp); tmp->level = caster_level (caster, spell); /*needed later, to get level dep. right. */ @@ -2030,7 +2026,7 @@ if (mflags & P_IS_ALIVE && spell->attacktype) { - for (target = get_map_ob (m, x, y); target; target = target->above) + for (target = GET_MAP_OB (m, x, y); target; target = target->above) if (QUERY_FLAG (target, FLAG_MONSTER)) { /* oky doky. got a target monster. Lets make a blinding attack */ @@ -2122,12 +2118,12 @@ if (mflags & P_IS_ALIVE) { /* search this square for a victim */ - for (walk = get_map_ob (m, x, y); walk; walk = walk->above) + for (walk = GET_MAP_OB (m, x, y); walk; walk = walk->above) if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) { /* found a victim */ object *disease = arch_to_object (spell->other_arch); - set_owner (disease, op); + disease->set_owner (op); set_spell_skill (op, caster, spell, disease); disease->stats.exp = 0; disease->level = caster_level (caster, spell);