ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/spell_effect.C
(Generate patch)

Comparing deliantra/server/server/spell_effect.C (file contents):
Revision 1.45 by root, Mon Apr 16 06:23:43 2007 UTC vs.
Revision 1.46 by root, Tue Apr 24 12:32:16 2007 UTC

1/* 1/*
2 * CrossFire, A Multiplayer game for X-windows 2 * CrossFire, A Multiplayer game
3 * 3 *
4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team 4 * Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team 5 * Copyright (C) 2002 Mark Wedel & Crossfire Development Team
6 * Copyright (C) 1992 Frank Tore Johansen 6 * Copyright (C) 1992 Frank Tore Johansen
7 * 7 *
2243 * This code was very odd - code early on would only let players use the spell, 2243 * This code was very odd - code early on would only let players use the spell,
2244 * yet the code wass full of player checks. I've presumed that the code 2244 * yet the code wass full of player checks. I've presumed that the code
2245 * that only let players use it was correct, and removed all the other 2245 * that only let players use it was correct, and removed all the other
2246 * player checks. MSW 2003-01-06 2246 * player checks. MSW 2003-01-06
2247 */ 2247 */
2248
2249int 2248int
2250animate_weapon (object *op, object *caster, object *spell, int dir) 2249animate_weapon (object *op, object *caster, object *spell, int dir)
2251{ 2250{
2252 object *weapon, *tmp; 2251 object *weapon, *tmp;
2253 char buf[MAX_BUF]; 2252 char buf[MAX_BUF];
2265 /* exit if it's not a player using this spell. */ 2264 /* exit if it's not a player using this spell. */
2266 if (op->type != PLAYER) 2265 if (op->type != PLAYER)
2267 return 0; 2266 return 0;
2268 2267
2269 /* if player already has a golem, abort */ 2268 /* if player already has a golem, abort */
2270 if (op->contr->ranges[range_golem]) 2269 if (object *golem = op->contr->ranges[range_golem])
2271 { 2270 {
2272 control_golem (op->contr->ranges[range_golem], dir); 2271 control_golem (golem, dir);
2273 return 0; 2272 return 0;
2274 } 2273 }
2275 2274
2276 /* if no direction specified, pick one */ 2275 /* if no direction specified, pick one */
2277 if (!dir) 2276 if (!dir)
2327 CLEAR_FLAG (tmp, FLAG_MONSTER); 2326 CLEAR_FLAG (tmp, FLAG_MONSTER);
2328 tmp->stats.exp = 0; 2327 tmp->stats.exp = 0;
2329 add_friendly_object (tmp); 2328 add_friendly_object (tmp);
2330 tmp->type = GOLEM; 2329 tmp->type = GOLEM;
2331 tmp->set_owner (op); 2330 tmp->set_owner (op);
2332 set_spell_skill (op, caster, spell, tmp);
2333 op->contr->ranges[range_golem] = tmp; 2331 op->contr->ranges[range_golem] = tmp;
2334 op->contr->shoottype = range_golem; 2332 op->contr->shoottype = range_golem;
2333 set_spell_skill (op, caster, spell, tmp);
2335 2334
2336 /* Give the weapon to the golem now. A bit of a hack to check the 2335 /* Give the weapon to the golem now. A bit of a hack to check the
2337 * removed flag - it should only be set if get_split_object was 2336 * removed flag - it should only be set if get_split_object was
2338 * used above. 2337 * used above.
2339 */ 2338 */
2340 if (!QUERY_FLAG (weapon, FLAG_REMOVED)) 2339 if (!QUERY_FLAG (weapon, FLAG_REMOVED))
2341 weapon->remove (); 2340 weapon->remove ();
2341
2342 insert_ob_in_ob (weapon, tmp); 2342 insert_ob_in_ob (weapon, tmp);
2343 esrv_send_item (op, weapon); 2343 esrv_send_item (op, weapon);
2344 /* To do everything necessary to let a golem use the weapon is a pain, 2344 /* To do everything necessary to let a golem use the weapon is a pain,
2345 * so instead, just set it as equipped (otherwise, we need to update 2345 * so instead, just set it as equipped (otherwise, we need to update
2346 * body_info, skills, etc) 2346 * body_info, skills, etc)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines