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.124 by root, Mon Oct 29 23:55:57 2012 UTC vs.
Revision 1.125 by root, Mon Nov 12 03:48:34 2012 UTC

338 338
339/* cast_create_object: creates object new_op in direction dir 339/* cast_create_object: creates object new_op in direction dir
340 * or if that is blocked, beneath the player (op). 340 * or if that is blocked, beneath the player (op).
341 * we pass 'caster', but don't use it for anything. 341 * we pass 'caster', but don't use it for anything.
342 * This is really just a simple wrapper function . 342 * This is really just a simple wrapper function .
343 * returns the direction that the object was actually placed 343 * returns true to indicate whether the operation was successful.
344 * in. 344 * destroys the object is unsuccessful.
345 */ 345 */
346int 346bool
347cast_create_obj (object *op, object *caster, object *new_op, int dir) 347cast_create_obj (object *op, object *caster, object *new_op, int dir)
348{ 348{
349 maptile *m; 349 mapxy pos (op);
350 sint16 sx, sy; 350 pos.move (dir);
351 351
352 if (dir && 352 if (!pos.normalise ()
353 ((get_map_flags (op->map, &m, op->x + freearr_x[dir], op->y + freearr_y[dir], &sx, &sy) & P_OUT_OF_MAP) || 353 || pos->blocks (op) // perversely enough, we check if the palyer can reach that space
354 OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy)))) 354 || !new_op->can_drop_at (pos.m, pos.x, pos.y)
355 )
355 { 356 {
356 new_draw_info (NDI_UNIQUE, 0, op, "Something is in the way."); 357 op->failmsg ("Your spell fizzles! H<Something is in the way.>");
357 new_draw_info (NDI_UNIQUE, 0, op, "You cast it at your feet."); 358 new_op->destroy ();
358 dir = 0; 359 return 0;
359 } 360 }
360 361
361 new_op->set_flag (FLAG_IDENTIFIED); 362 new_op->set_flag (FLAG_IDENTIFIED);
362 op->map->insert (new_op,
363 op->x + freearr_x[dir], op->y + freearr_y[dir],
364 op,
365 dir ? 0 : INS_BELOW_ORIGINATOR);
366 363
364 pos.insert (new_op, op, dir ? 0 : INS_BELOW_ORIGINATOR);
365
367 return dir; 366 return 1;
368} 367}
369 368
370static bool 369static bool
371mergable_owner (object *o1, object *o2) 370mergable_owner (object *o1, object *o2)
372{ 371{
820 op->failmsgf ("%s smites you!" HINT_GRACE, godname); 819 op->failmsgf ("%s smites you!" HINT_GRACE, godname);
821 cast_magic_storm (op, tmp, power); 820 cast_magic_storm (op, tmp, power);
822 } 821 }
823} 822}
824 823
825/* 824/*
826 * spell_failure() handles the various effects for differing degrees 825 * spell_failure() handles the various effects for differing degrees
827 * of failure badness. 826 * of failure badness.
828 * op is the player that failed. 827 * op is the player that failed.
829 * failure is a random value of how badly you failed. 828 * failure is a random value of how badly you failed.
830 * power is how many spellpoints you'd normally need for the spell. 829 * power is how many spellpoints you'd normally need for the spell.
831 * skill is the skill you'd need to cast the spell. 830 * skill is the skill you'd need to cast the spell.
832 */ 831 */
833
834void 832void
835spell_failure (object *op, int failure, int power, object *skill) 833spell_failure (object *op, int failure, int power, object *skill)
836{ 834{
837 object *tmp; 835 object *tmp;
838 836

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines