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

Comparing deliantra/server/server/spell_attack.C (file contents):
Revision 1.13 by root, Thu Sep 14 22:34:05 2006 UTC vs.
Revision 1.27 by root, Mon Jan 8 01:19:04 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
3 3
4 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2002-2003 Mark Wedel & Crossfire Development Team 5 Copyright (C) 2002-2003 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 Copyright (C) 1992 Frank Tore Johansen
6 7
7 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
27 */ 28 */
28 29
29#include <global.h> 30#include <global.h>
30#include <object.h> 31#include <object.h>
31#include <living.h> 32#include <living.h>
32#ifndef __CEXTRACT__
33# include <sproto.h> 33#include <sproto.h>
34#endif
35#include <spells.h> 34#include <spells.h>
36#include <sounds.h> 35#include <sounds.h>
37 36
38/* this function checks to see if a spell pushes objects as well 37/* this function checks to see if a spell pushes objects as well
39 * as flies over and damages them (only used for cones for now) 38 * as flies over and damages them (only used for cones for now)
57 { 56 {
58 weight_move = op->weight + (op->weight * op->level) / 3; 57 weight_move = op->weight + (op->weight * op->level) / 3;
59 /*LOG (llevDebug, "DEBUG: arch weighs %d and masses %d (%s,level %d)\n", op->weight,weight_move,op->name,op->level); */ 58 /*LOG (llevDebug, "DEBUG: arch weighs %d and masses %d (%s,level %d)\n", op->weight,weight_move,op->name,op->level); */
60 } 59 }
61 60
62 for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 61 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above)
63 { 62 {
64 int num_sections = 1; 63 int num_sections = 1;
65 64
66 /* don't move DM */ 65 /* don't move DM */
67 if (QUERY_FLAG (tmp, FLAG_WIZ)) 66 if (QUERY_FLAG (tmp, FLAG_WIZ))
117void 116void
118forklightning (object *op, object *tmp) 117forklightning (object *op, object *tmp)
119{ 118{
120 int new_dir = 1; /* direction or -1 for left, +1 for right 0 if no new bolt */ 119 int new_dir = 1; /* direction or -1 for left, +1 for right 0 if no new bolt */
121 int t_dir; /* stores temporary dir calculation */ 120 int t_dir; /* stores temporary dir calculation */
122 mapstruct *m; 121 maptile *m;
123 sint16 sx, sy; 122 sint16 sx, sy;
124 object *new_bolt; 123 object *new_bolt;
125 124
126 /* pick a fork direction. tmp->stats.Con is the left bias 125 /* pick a fork direction. tmp->stats.Con is the left bias
127 * i.e., the chance in 100 of forking LEFT 126 * i.e., the chance in 100 of forking LEFT
140 139
141 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (m, sx, sy))) 140 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (m, sx, sy)))
142 return; 141 return;
143 142
144 /* OK, we made a fork */ 143 /* OK, we made a fork */
145 new_bolt = get_object (); 144 new_bolt = tmp->clone ();
146 copy_object (tmp, new_bolt);
147 145
148 /* reduce chances of subsequent forking */ 146 /* reduce chances of subsequent forking */
149 new_bolt->stats.Dex -= 10; 147 new_bolt->stats.Dex -= 10;
150 tmp->stats.Dex -= 10; /* less forks from main bolt too */ 148 tmp->stats.Dex -= 10; /* less forks from main bolt too */
151 new_bolt->stats.Con += 25 * new_dir; /* adjust the left bias */ 149 new_bolt->stats.Con += 25 * new_dir; /* adjust the left bias */
152 new_bolt->speed_left = -0.1; 150 new_bolt->speed_left = -0.1;
153 new_bolt->direction = t_dir; 151 new_bolt->direction = t_dir;
154 new_bolt->duration++; 152 new_bolt->duration++;
155 new_bolt->x = sx;
156 new_bolt->y = sy;
157 new_bolt->stats.dam /= 2; /* reduce daughter bolt damage */ 153 new_bolt->stats.dam /= 2; /* reduce daughter bolt damage */
158 new_bolt->stats.dam++; 154 new_bolt->stats.dam++;
159 tmp->stats.dam /= 2; /* reduce father bolt damage */ 155 tmp->stats.dam /= 2; /* reduce father bolt damage */
160 tmp->stats.dam++; 156 tmp->stats.dam++;
161 new_bolt = insert_ob_in_map (new_bolt, m, op, 0); 157 if ((new_bolt = m->insert (new_bolt, sx, sy, op)))
162 update_turn_face (new_bolt); 158 update_turn_face (new_bolt);
163} 159}
164 160
165/* move_bolt: moves bolt 'op'. Basically, it just advances a space, 161/* move_bolt: moves bolt 'op'. Basically, it just advances a space,
166 * and checks for various things that may stop it. 162 * and checks for various things that may stop it.
167 */ 163 */
170move_bolt (object *op) 166move_bolt (object *op)
171{ 167{
172 object *tmp; 168 object *tmp;
173 int mflags; 169 int mflags;
174 sint16 x, y; 170 sint16 x, y;
175 mapstruct *m; 171 maptile *m;
176 172
177 if (--(op->duration) < 0) 173 if (--op->duration < 0)
178 { 174 {
179 remove_ob (op); 175 op->destroy ();
180 free_object (op);
181 return; 176 return;
182 } 177 }
183 178
184 hit_map (op, 0, op->attacktype, 1); 179 hit_map (op, 0, op->attacktype, 1);
185 180
186 if (!op->direction) 181 if (!op->direction)
187 return; 182 return;
188 183
189 if (--op->range < 0) 184 if (--op->range < 0)
190 {
191 op->range = 0; 185 op->range = 0;
192 }
193 else 186 else
194 { 187 {
195 x = op->x + DIRX (op); 188 x = op->x + DIRX (op);
196 y = op->y + DIRY (op); 189 y = op->y + DIRY (op);
197 m = op->map; 190 m = op->map;
205 * on the space. So only call reflwall if we think the data it returns 198 * on the space. So only call reflwall if we think the data it returns
206 * will be useful. 199 * will be useful.
207 */ 200 */
208 if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y)) || ((mflags & P_IS_ALIVE) && reflwall (m, x, y, op))) 201 if (OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, x, y)) || ((mflags & P_IS_ALIVE) && reflwall (m, x, y, op)))
209 { 202 {
210
211 if (!QUERY_FLAG (op, FLAG_REFLECTING)) 203 if (!QUERY_FLAG (op, FLAG_REFLECTING))
212 return; 204 return;
213 205
214 /* Since walls don't run diagonal, if the bolt is in 206 /* Since walls don't run diagonal, if the bolt is in
215 * one of 4 main directions, it just reflects back in the 207 * one of 4 main directions, it just reflects back in the
245 else if (left) 237 else if (left)
246 op->direction = absdir (op->direction + 2); 238 op->direction = absdir (op->direction + 2);
247 else if (right) 239 else if (right)
248 op->direction = absdir (op->direction - 2); 240 op->direction = absdir (op->direction - 2);
249 } 241 }
242
250 update_turn_face (op); /* A bolt *must* be IS_TURNABLE */ 243 update_turn_face (op); /* A bolt *must* be IS_TURNABLE */
251 return; 244 return;
252 } 245 }
253 else 246 else
254 { /* Create a copy of this object and put it ahead */ 247 { /* Create a copy of this object and put it ahead */
255 tmp = get_object (); 248 object *tmp = op->clone ();
256 copy_object (op, tmp); 249
250 m->insert (tmp, x, y, op);
257 tmp->speed_left = -0.1; 251 tmp->speed_left = -0.1;
258 tmp->x += DIRX (tmp), tmp->y += DIRY (tmp);
259 tmp = insert_ob_in_map (tmp, op->map, op, 0);
260 /* To make up for the decrease at the top of the function */ 252 /* To make up for the decrease at the top of the function */
261 tmp->duration++; 253 tmp->duration++;
262 254
263 /* New forking code. Possibly create forks of this object 255 /* New forking code. Possibly create forks of this object
264 * going off in other directions. 256 * going off in other directions.
265 */ 257 */
266
267 if (rndm (0, 99) < tmp->stats.Dex) 258 if (rndm (0, 99) < tmp->stats.Dex)
268 { /* stats.Dex % of forking */ 259 { /* stats.Dex % of forking */
269 forklightning (op, tmp); 260 forklightning (op, tmp);
270 } 261 }
262
271 /* In this way, the object left behind sticks on the space, but 263 /* In this way, the object left behind sticks on the space, but
272 * doesn't create any bolts that continue to move onward. 264 * doesn't create any bolts that continue to move onward.
273 */ 265 */
274 op->range = 0; 266 op->range = 0;
275 } /* copy object and move it along */ 267 } /* copy object and move it along */
282 * we remove the magic flag - that can be derived from 274 * we remove the magic flag - that can be derived from
283 * spob->attacktype. 275 * spob->attacktype.
284 * This function sets up the appropriate owner and skill 276 * This function sets up the appropriate owner and skill
285 * pointers. 277 * pointers.
286 */ 278 */
287
288int 279int
289fire_bolt (object *op, object *caster, int dir, object *spob, object *skill) 280fire_bolt (object *op, object *caster, int dir, object *spob, object *skill)
290{ 281{
291 object *tmp = NULL; 282 object *tmp = NULL;
292 int mflags; 283 int mflags;
310 301
311 tmp->direction = dir; 302 tmp->direction = dir;
312 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) 303 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE))
313 SET_ANIMATION (tmp, dir); 304 SET_ANIMATION (tmp, dir);
314 305
315 set_owner (tmp, op); 306 tmp->set_owner (op);
316 set_spell_skill (op, caster, spob, tmp); 307 set_spell_skill (op, caster, spob, tmp);
317 308
318 tmp->x = op->x + DIRX (tmp); 309 tmp->x = op->x + DIRX (tmp);
319 tmp->y = op->y + DIRY (tmp); 310 tmp->y = op->y + DIRY (tmp);
320 tmp->map = op->map; 311 tmp->map = op->map;
321 312
313 maptile *newmap;
322 mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); 314 mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y);
323 if (mflags & P_OUT_OF_MAP) 315 if (mflags & P_OUT_OF_MAP)
324 { 316 {
325 free_object (tmp); 317 tmp->destroy ();
326 return 0; 318 return 0;
327 } 319 }
320
321 tmp->map = newmap;
322
328 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) 323 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y)))
329 { 324 {
330 if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) 325 if (!QUERY_FLAG (tmp, FLAG_REFLECTING))
331 { 326 {
332 free_object (tmp); 327 tmp->destroy ();
333 return 0; 328 return 0;
334 } 329 }
330
335 tmp->x = op->x; 331 tmp->x = op->x;
336 tmp->y = op->y; 332 tmp->y = op->y;
337 tmp->direction = absdir (tmp->direction + 4); 333 tmp->direction = absdir (tmp->direction + 4);
338 tmp->map = op->map; 334 tmp->map = op->map;
339 } 335 }
340 if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)) != NULL) 336
337 if ((tmp = tmp->insert_at (tmp, op)))
341 move_bolt (tmp); 338 move_bolt (tmp);
339
342 return 1; 340 return 1;
343} 341}
344 342
345 343
346 344
355 * At least that is what I think this does. 353 * At least that is what I think this does.
356 */ 354 */
357void 355void
358explosion (object *op) 356explosion (object *op)
359{ 357{
360 object *tmp;
361 mapstruct *m = op->map; 358 maptile *m = op->map;
362 int i; 359 int i;
363 360
364 if (--(op->duration) < 0) 361 if (--op->duration < 0)
365 { 362 {
366 remove_ob (op); 363 op->destroy ();
367 free_object (op);
368 return; 364 return;
369 } 365 }
366
370 hit_map (op, 0, op->attacktype, 0); 367 hit_map (op, 0, op->attacktype, 0);
371 368
372 if (op->range > 0) 369 if (op->range > 0)
373 { 370 {
374 for (i = 1; i < 9; i++) 371 for (i = 1; i < 9; i++)
375 { 372 {
376 sint16 dx, dy; 373 sint16 dx, dy;
377 374
378 dx = op->x + freearr_x[i]; 375 dx = op->x + freearr_x[i];
379 dy = op->y + freearr_y[i]; 376 dy = op->y + freearr_y[i];
377
380 /* ok_to_put_more already does things like checks for walls, 378 /* ok_to_put_more already does things like checks for walls,
381 * out of map, etc. 379 * out of map, etc.
382 */ 380 */
383 if (ok_to_put_more (op->map, dx, dy, op, op->attacktype)) 381 if (ok_to_put_more (op->map, dx, dy, op, op->attacktype))
384 { 382 {
385 tmp = get_object (); 383 object *tmp = op->clone ();
386 copy_object (op, tmp); 384
387 tmp->state = 0; 385 tmp->state = 0;
388 tmp->speed_left = -0.21; 386 tmp->speed_left = -0.21;
389 tmp->range--; 387 tmp->range--;
390 tmp->value = 0; 388 tmp->value = 0;
391 tmp->x = dx; 389
392 tmp->y = dy; 390 m->insert (tmp, dx, dy, op);
393 insert_ob_in_map (tmp, m, op, 0);
394 } 391 }
395 } 392 }
396 } 393 }
397} 394}
398 395
402 * explode. 399 * explode.
403 */ 400 */
404void 401void
405explode_bullet (object *op) 402explode_bullet (object *op)
406{ 403{
407 tag_t op_tag = op->count;
408 object *tmp, *owner; 404 object *tmp, *owner;
409 405
410 if (op->other_arch == NULL) 406 if (op->other_arch == NULL)
411 { 407 {
412 LOG (llevError, "BUG: explode_bullet(): op without other_arch\n"); 408 LOG (llevError, "BUG: explode_bullet(): op without other_arch\n");
413 remove_ob (op); 409 op->destroy ();
414 free_object (op);
415 return; 410 return;
416 } 411 }
417 412
418 if (op->env) 413 if (op->env)
419 { 414 {
420 object *env;
421
422 env = object_get_env_recursive (op); 415 object *env = object_get_env_recursive (op);
423 if (env->map == NULL || out_of_map (env->map, env->x, env->y)) 416 if (env->map == NULL || out_of_map (env->map, env->x, env->y))
424 { 417 {
425 LOG (llevError, "BUG: explode_bullet(): env out of map\n"); 418 LOG (llevError, "BUG: explode_bullet(): env out of map\n");
426 remove_ob (op); 419 op->destroy ();
427 free_object (op);
428 return; 420 return;
429 } 421 }
430 remove_ob (op); 422
431 op->x = env->x; 423 op->insert_at (env, op, INS_NO_MERGE | INS_NO_WALK_ON);
432 op->y = env->y;
433 insert_ob_in_map (op, env->map, op, INS_NO_MERGE | INS_NO_WALK_ON);
434 } 424 }
435 else if (out_of_map (op->map, op->x, op->y)) 425 else if (out_of_map (op->map, op->x, op->y))
436 { 426 {
437 LOG (llevError, "BUG: explode_bullet(): op out of map\n"); 427 LOG (llevError, "BUG: explode_bullet(): op out of map\n");
438 remove_ob (op); 428 op->destroy ();
439 free_object (op);
440 return; 429 return;
441 } 430 }
442 431
443 // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent explosions of any kind on safe maps 432 // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent explosions of any kind on safe maps
444 // NOTE: If this breaks something important: remove this. I can't think of anything 433 // NOTE: If this breaks something important: remove this. I can't think of anything
445 // bad at the moment that might happen from this. 434 // bad at the moment that might happen from this.
446 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) 435 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE)
447 { 436 {
448 remove_ob (op); 437 op->destroy ();
449 free_object (op);
450 return; 438 return;
451 } 439 }
452 440
453 if (op->attacktype) 441 if (op->attacktype)
454 { 442 {
455 hit_map (op, 0, op->attacktype, 1); 443 hit_map (op, 0, op->attacktype, 1);
456 if (was_destroyed (op, op_tag)) 444 if (op->destroyed ())
457 return; 445 return;
458 } 446 }
459 447
460 /* other_arch contains what this explodes into */ 448 /* other_arch contains what this explodes into */
461 tmp = arch_to_object (op->other_arch); 449 tmp = arch_to_object (op->other_arch);
462 450
463 copy_owner (tmp, op); 451 tmp->set_owner (op);
464 tmp->skill = op->skill; 452 tmp->skill = op->skill;
465 453
466 owner = get_owner (op); 454 owner = op->owner;
467 455
468 if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner)) 456 if ((tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) && owner && !tailor_god_spell (tmp, owner))
469 { 457 {
470 remove_ob (op); 458 op->destroy ();
471 free_object (op);
472 return; 459 return;
473 } 460 }
474
475 tmp->x = op->x;
476 tmp->y = op->y;
477 461
478 /* special for bombs - it actually has sane values for these */ 462 /* special for bombs - it actually has sane values for these */
479 if (op->type == SPELL_EFFECT && op->subtype == SP_BOMB) 463 if (op->type == SPELL_EFFECT && op->subtype == SP_BOMB)
480 { 464 {
481 tmp->attacktype = op->attacktype; 465 tmp->attacktype = op->attacktype;
485 } 469 }
486 else 470 else
487 { 471 {
488 if (op->attacktype & AT_MAGIC) 472 if (op->attacktype & AT_MAGIC)
489 tmp->attacktype |= AT_MAGIC; 473 tmp->attacktype |= AT_MAGIC;
474
490 /* Spell doc describes what is going on here */ 475 /* Spell doc describes what is going on here */
491 tmp->stats.dam = op->dam_modifier; 476 tmp->stats.dam = op->dam_modifier;
492 tmp->range = op->stats.maxhp; 477 tmp->range = op->stats.maxhp;
493 tmp->duration = op->stats.hp; 478 tmp->duration = op->stats.hp;
494 /* Used for spell tracking - just need a unique val for this spell - 479 /* Used for spell tracking - just need a unique val for this spell -
502 tmp->stats.sp = op->direction; 487 tmp->stats.sp = op->direction;
503 488
504 /* Prevent recursion */ 489 /* Prevent recursion */
505 op->move_on = 0; 490 op->move_on = 0;
506 491
507 insert_ob_in_map (tmp, op->map, op, 0); 492 tmp->insert_at (op, op);
508 /* remove the firebullet */ 493 /* remove the firebullet */
509 if (!was_destroyed (op, op_tag)) 494 op->destroy ();
510 {
511 remove_ob (op);
512 free_object (op);
513 }
514} 495}
515
516
517 496
518/* checks to see what op should do, given the space it is on 497/* checks to see what op should do, given the space it is on
519 * (eg, explode, damage player, etc) 498 * (eg, explode, damage player, etc)
520 */ 499 */
521
522void 500void
523check_bullet (object *op) 501check_bullet (object *op)
524{ 502{
525 tag_t op_tag = op->count, tmp_tag;
526 object *tmp; 503 object *tmp;
527 int dam, mflags; 504 int dam, mflags;
528 mapstruct *m; 505 maptile *m;
529 sint16 sx, sy; 506 sint16 sx, sy;
530 507
531 mflags = get_map_flags (op->map, &m, op->x, op->y, &sx, &sy); 508 mflags = get_map_flags (op->map, &m, op->x, op->y, &sx, &sy);
532 509
533 if (!(mflags & P_IS_ALIVE) && !OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy))) 510 if (!(mflags & P_IS_ALIVE) && !OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, sx, sy)))
542 519
543 /* If nothing alive on this space, no reason to do anything further */ 520 /* If nothing alive on this space, no reason to do anything further */
544 if (!(mflags & P_IS_ALIVE)) 521 if (!(mflags & P_IS_ALIVE))
545 return; 522 return;
546 523
547 for (tmp = get_map_ob (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above) 524 for (tmp = GET_MAP_OB (op->map, op->x, op->y); tmp != NULL; tmp = tmp->above)
548 { 525 {
549 if (QUERY_FLAG (tmp, FLAG_ALIVE)) 526 if (QUERY_FLAG (tmp, FLAG_ALIVE))
550 { 527 {
551 tmp_tag = tmp->count;
552 dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1); 528 dam = hit_player (tmp, op->stats.dam, op, op->attacktype, 1);
553 if (was_destroyed (op, op_tag) || !was_destroyed (tmp, tmp_tag) || (op->stats.dam -= dam) < 0) 529 if (op->destroyed () || !tmp->destroyed () || (op->stats.dam -= dam) < 0)
554 { 530 {
555 if (!QUERY_FLAG (op, FLAG_REMOVED)) 531 if (!QUERY_FLAG (op, FLAG_REMOVED))
556 { 532 {
557 remove_ob (op); 533 op->destroy ();
558 free_object (op);
559 return; 534 return;
560 } 535 }
561 } 536 }
562 } 537 }
563 } 538 }
564} 539}
565
566 540
567/* Basically, we move 'op' one square, and if it hits something, 541/* Basically, we move 'op' one square, and if it hits something,
568 * call check_bullet. 542 * call check_bullet.
569 * This function is only applicable to bullets, but not to all 543 * This function is only applicable to bullets, but not to all
570 * fired arches (eg, bolts). 544 * fired arches (eg, bolts).
571 */ 545 */
572
573void 546void
574move_bullet (object *op) 547move_bullet (object *op)
575{ 548{
576 sint16 new_x, new_y; 549 sint16 new_x, new_y;
577 int mflags; 550 int mflags;
578 mapstruct *m; 551 maptile *m;
579 552
580#if 0 553#if 0
581 /* We need a better general purpose way to do this */ 554 /* We need a better general purpose way to do this */
582 555
583 /* peterm: added to make comet leave a trail of burnouts 556 /* peterm: added to make comet leave a trail of burnouts
584 it's an unadulterated hack, but the effect is cool. */ 557 it's an unadulterated hack, but the effect is cool. */
585 if (op->stats.sp == SP_METEOR) 558 if (op->stats.sp == SP_METEOR)
586 { 559 {
587 replace_insert_ob_in_map ("fire_trail", op); 560 replace_insert_ob_in_map ("fire_trail", op);
588 if (was_destroyed (op, op_tag)) 561 if (op->destroyed ())
589 return; 562 return;
590 } /* end addition. */ 563 } /* end addition. */
591#endif 564#endif
592 565
593 /* Reached the end of its life - remove it */ 566 /* Reached the end of its life - remove it */
594 if (--op->range <= 0) 567 if (--op->range <= 0)
595 { 568 {
596 if (op->other_arch) 569 if (op->other_arch)
597 {
598 explode_bullet (op); 570 explode_bullet (op);
599 }
600 else 571 else
601 { 572 op->destroy ();
602 remove_ob (op); 573
603 free_object (op);
604 }
605 return; 574 return;
606 } 575 }
607 576
608 new_x = op->x + DIRX (op); 577 new_x = op->x + DIRX (op);
609 new_y = op->y + DIRY (op); 578 new_y = op->y + DIRY (op);
610 m = op->map; 579 m = op->map;
611 mflags = get_map_flags (m, &m, new_x, new_y, &new_x, &new_y); 580 mflags = get_map_flags (m, &m, new_x, new_y, &new_x, &new_y);
612 581
613 if (mflags & P_OUT_OF_MAP) 582 if (mflags & P_OUT_OF_MAP)
614 { 583 {
615 remove_ob (op); 584 op->destroy ();
616 free_object (op);
617 return; 585 return;
618 } 586 }
619 587
620 if (!op->direction || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))) 588 if (!op->direction || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y)))
621 { 589 {
622 if (op->other_arch) 590 if (op->other_arch)
623 {
624 explode_bullet (op); 591 explode_bullet (op);
625 }
626 else 592 else
627 { 593 op->destroy ();
628 remove_ob (op); 594
629 free_object (op);
630 }
631 return; 595 return;
632 } 596 }
633 597
634 remove_ob (op); 598 if (!(op = m->insert (op, new_x, new_y, op)))
635 op->x = new_x;
636 op->y = new_y;
637 if ((op = insert_ob_in_map (op, m, op, 0)) == NULL)
638 return; 599 return;
639 600
640 if (reflwall (op->map, op->x, op->y, op)) 601 if (reflwall (op->map, op->x, op->y, op))
641 { 602 {
642 op->direction = absdir (op->direction + 4); 603 op->direction = absdir (op->direction + 4);
643 update_turn_face (op); 604 update_turn_face (op);
644 } 605 }
645 else 606 else
646 {
647 check_bullet (op); 607 check_bullet (op);
648 }
649} 608}
650 609
651 610
652 611
653 612
688 647
689 tmp->direction = dir; 648 tmp->direction = dir;
690 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) 649 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE))
691 SET_ANIMATION (tmp, dir); 650 SET_ANIMATION (tmp, dir);
692 651
693 set_owner (tmp, op); 652 tmp->set_owner (op);
694 set_spell_skill (op, caster, spob, tmp); 653 set_spell_skill (op, caster, spob, tmp);
695 654
696 tmp->x = op->x + freearr_x[dir]; 655 tmp->x = op->x + freearr_x[dir];
697 tmp->y = op->y + freearr_y[dir]; 656 tmp->y = op->y + freearr_y[dir];
698 tmp->map = op->map; 657 tmp->map = op->map;
699 658
659 maptile *newmap;
700 mflags = get_map_flags (tmp->map, &tmp->map, tmp->x, tmp->y, &tmp->x, &tmp->y); 660 mflags = get_map_flags (tmp->map, &newmap, tmp->x, tmp->y, &tmp->x, &tmp->y);
701 if (mflags & P_OUT_OF_MAP) 661 if (mflags & P_OUT_OF_MAP)
702 { 662 {
703 free_object (tmp); 663 tmp->destroy ();
704 return 0; 664 return 0;
705 } 665 }
666
667 tmp->map = newmap;
668
706 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y))) 669 if (OB_TYPE_MOVE_BLOCK (tmp, GET_MAP_MOVE_BLOCK (tmp->map, tmp->x, tmp->y)))
707 { 670 {
708 if (!QUERY_FLAG (tmp, FLAG_REFLECTING)) 671 if (!QUERY_FLAG (tmp, FLAG_REFLECTING))
709 { 672 {
710 free_object (tmp); 673 tmp->destroy ();
711 return 0; 674 return 0;
712 } 675 }
676
713 tmp->x = op->x; 677 tmp->x = op->x;
714 tmp->y = op->y; 678 tmp->y = op->y;
715 tmp->direction = absdir (tmp->direction + 4); 679 tmp->direction = absdir (tmp->direction + 4);
716 tmp->map = op->map; 680 tmp->map = op->map;
717 } 681 }
718 if ((tmp = insert_ob_in_map (tmp, tmp->map, op, 0)) != NULL) 682
719 { 683 if ((tmp = tmp->insert_at (tmp, op)))
720 check_bullet (tmp); 684 check_bullet (tmp);
721 } 685
722 return 1; 686 return 1;
723} 687}
724 688
725 689
726 690
736void 700void
737cone_drop (object *op) 701cone_drop (object *op)
738{ 702{
739 object *new_ob = arch_to_object (op->other_arch); 703 object *new_ob = arch_to_object (op->other_arch);
740 704
741 new_ob->x = op->x;
742 new_ob->y = op->y;
743 new_ob->level = op->level; 705 new_ob->level = op->level;
744 set_owner (new_ob, op->owner); 706 new_ob->set_owner (op->owner);
745 707
746 /* preserve skill ownership */ 708 /* preserve skill ownership */
747 if (op->skill && op->skill != new_ob->skill) 709 if (op->skill && op->skill != new_ob->skill)
748 {
749 new_ob->skill = op->skill; 710 new_ob->skill = op->skill;
750 }
751 insert_ob_in_map (new_ob, op->map, op, 0);
752 711
712 new_ob->insert_at (op, op);
753} 713}
754 714
755/* move_cone: causes cone object 'op' to move a space/hit creatures */ 715/* move_cone: causes cone object 'op' to move a space/hit creatures */
756 716
757void 717void
758move_cone (object *op) 718move_cone (object *op)
759{ 719{
760 int i; 720 int i;
761 tag_t tag;
762 721
763 /* if no map then hit_map will crash so just ignore object */ 722 /* if no map then hit_map will crash so just ignore object */
764 if (!op->map) 723 if (!op->map)
765 { 724 {
766 LOG (llevError, "Tried to move_cone object %s without a map.\n", op->name ? &op->name : "unknown"); 725 LOG (llevError, "Tried to move_cone object %s without a map.\n", op->name ? &op->name : "unknown");
767 op->speed = 0; 726 op->set_speed (0);
768 update_ob_speed (op);
769 return; 727 return;
770 } 728 }
771 729
772 /* lava saves it's life, but not yours :) */ 730 /* lava saves it's life, but not yours :) */
773 if (QUERY_FLAG (op, FLAG_LIFESAVE)) 731 if (QUERY_FLAG (op, FLAG_LIFESAVE))
779#if 0 737#if 0
780 /* Disable this - enabling it makes monsters easier, as 738 /* Disable this - enabling it makes monsters easier, as
781 * when their cone dies when they die. 739 * when their cone dies when they die.
782 */ 740 */
783 /* If no owner left, the spell dies out. */ 741 /* If no owner left, the spell dies out. */
784 if (get_owner (op) == NULL) 742 if (op->owner == NULL)
785 { 743 {
786 remove_ob (op); 744 op->destroy ();
787 free_object (op);
788 return; 745 return;
789 } 746 }
790#endif 747#endif
791 748
792 tag = op->count;
793 hit_map (op, 0, op->attacktype, 0); 749 hit_map (op, 0, op->attacktype, 0);
794 750
795 /* Check to see if we should push anything. 751 /* Check to see if we should push anything.
796 * Spell objects with weight push whatever they encounter to some 752 * Spell objects with weight push whatever they encounter to some
797 * degree. 753 * degree.
798 */ 754 */
799 if (op->weight) 755 if (op->weight)
800 check_spell_knockback (op); 756 check_spell_knockback (op);
801 757
802 if (was_destroyed (op, tag)) 758 if (op->destroyed ())
803 return; 759 return;
804 760
805 if ((op->duration--) < 0) 761 if ((op->duration--) < 0)
806 { 762 {
807 remove_ob (op); 763 op->destroy ();
808 free_object (op);
809 return; 764 return;
810 } 765 }
811 /* Object has hit maximum range, so don't have it move 766 /* Object has hit maximum range, so don't have it move
812 * any further. When the duration above expires, 767 * any further. When the duration above expires,
813 * then the object will get removed. 768 * then the object will get removed.
822 { 777 {
823 sint16 x = op->x + freearr_x[absdir (op->stats.sp + i)], y = op->y + freearr_y[absdir (op->stats.sp + i)]; 778 sint16 x = op->x + freearr_x[absdir (op->stats.sp + i)], y = op->y + freearr_y[absdir (op->stats.sp + i)];
824 779
825 if (ok_to_put_more (op->map, x, y, op, op->attacktype)) 780 if (ok_to_put_more (op->map, x, y, op, op->attacktype))
826 { 781 {
827 object *tmp = get_object (); 782 object *tmp = op->clone ();
828
829 copy_object (op, tmp);
830 tmp->x = x;
831 tmp->y = y;
832 783
833 tmp->duration = op->duration + 1; 784 tmp->duration = op->duration + 1;
834 785
835 /* Use for spell tracking - see ok_to_put_more() */ 786 /* Use for spell tracking - see ok_to_put_more() */
836 tmp->stats.maxhp = op->stats.maxhp; 787 tmp->stats.maxhp = op->stats.maxhp;
837 insert_ob_in_map (tmp, op->map, op, 0); 788
789 op->map->insert (tmp, x, y, op);
790
838 if (tmp->other_arch) 791 if (tmp->other_arch)
839 cone_drop (tmp); 792 cone_drop (tmp);
840 } 793 }
841 } 794 }
842} 795}
852int 805int
853cast_cone (object *op, object *caster, int dir, object *spell) 806cast_cone (object *op, object *caster, int dir, object *spell)
854{ 807{
855 object *tmp; 808 object *tmp;
856 int i, success = 0, range_min = -1, range_max = 1; 809 int i, success = 0, range_min = -1, range_max = 1;
857 mapstruct *m; 810 maptile *m;
858 sint16 sx, sy; 811 sint16 sx, sy;
859 MoveType movetype; 812 MoveType movetype;
860 813
861 if (!spell->other_arch) 814 if (!spell->other_arch)
862 return 0; 815 return 0;
918 if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype) 871 if ((movetype & GET_MAP_MOVE_BLOCK (m, sx, sy)) == movetype)
919 continue; 872 continue;
920 873
921 success = 1; 874 success = 1;
922 tmp = arch_to_object (spell->other_arch); 875 tmp = arch_to_object (spell->other_arch);
923 set_owner (tmp, op); 876 tmp->set_owner (op);
924 set_spell_skill (op, caster, spell, tmp); 877 set_spell_skill (op, caster, spell, tmp);
925 tmp->level = caster_level (caster, spell); 878 tmp->level = caster_level (caster, spell);
926 tmp->x = sx;
927 tmp->y = sy;
928 tmp->attacktype = spell->attacktype; 879 tmp->attacktype = spell->attacktype;
929 880
930 /* holy word stuff */ 881 /* holy word stuff */
931 if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER)) 882 if ((tmp->attacktype & AT_HOLYWORD) || (tmp->attacktype & AT_GODPOWER))
932 if (!tailor_god_spell (tmp, op)) 883 if (!tailor_god_spell (tmp, op))
969 920
970 if (!(tmp->move_type & MOVE_FLY_LOW)) 921 if (!(tmp->move_type & MOVE_FLY_LOW))
971 LOG (llevDebug, "cast_cone(): arch %s doesn't have flying 1\n", &spell->other_arch->name); 922 LOG (llevDebug, "cast_cone(): arch %s doesn't have flying 1\n", &spell->other_arch->name);
972 923
973 if (!tmp->move_on && tmp->stats.dam) 924 if (!tmp->move_on && tmp->stats.dam)
974 {
975 LOG (llevDebug, "cast_cone(): arch %s doesn't have move_on set\n", &spell->other_arch->name); 925 LOG (llevDebug, "cast_cone(): arch %s doesn't have move_on set\n", &spell->other_arch->name);
976 }
977 926
978 insert_ob_in_map (tmp, m, op, 0); 927 m->insert (tmp, sx, sy, op);
979 928
980 /* This is used for tracking spells so that one effect doesn't hit 929 /* This is used for tracking spells so that one effect doesn't hit
981 * a single space too many times. 930 * a single space too many times.
982 */ 931 */
983 tmp->stats.maxhp = tmp->count; 932 tmp->stats.maxhp = tmp->count;
1002void 951void
1003animate_bomb (object *op) 952animate_bomb (object *op)
1004{ 953{
1005 int i; 954 int i;
1006 object *env, *tmp; 955 object *env, *tmp;
1007 archetype *at;
1008 956
1009 if (op->state != NUM_ANIMATIONS (op) - 1) 957 if (op->state != NUM_ANIMATIONS (op) - 1)
1010 return; 958 return;
1011 959
1012 env = object_get_env_recursive (op); 960 env = object_get_env_recursive (op);
1017 return; 965 return;
1018 966
1019 if (env->type == PLAYER) 967 if (env->type == PLAYER)
1020 esrv_del_item (env->contr, op->count); 968 esrv_del_item (env->contr, op->count);
1021 969
1022 remove_ob (op); 970 if (!(op = op->insert_at (env, op)))
1023 op->x = env->x;
1024 op->y = env->y;
1025 if ((op = insert_ob_in_map (op, env->map, op, 0)) == NULL)
1026 return; 971 return;
1027 } 972 }
1028 973
1029 // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent bomb from exploding 974 // elmex Tue Aug 15 17:46:51 CEST 2006: Prevent bomb from exploding
1030 // on a safe map. I don't like this special casing, but it seems to be neccessary 975 // on a safe map. I don't like this special casing, but it seems to be neccessary
1031 // as bombs can be carried. 976 // as bombs can be carried.
1032 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE) 977 if (get_map_flags (op->map, NULL, op->x, op->y, NULL, NULL) & P_SAFE)
1033 { 978 {
1034 remove_ob (op); 979 op->destroy ();
1035 free_object (op);
1036 return; 980 return;
1037 } 981 }
1038 982
1039 /* This copies a lot of the code from the fire bullet, 983 /* This copies a lot of the code from the fire bullet,
1040 * but using the cast_bullet isn't really feasible, 984 * but using the cast_bullet isn't really feasible,
1041 * so just set up the appropriate values. 985 * so just set up the appropriate values.
1042 */ 986 */
1043 at = archetype::find (SPLINT); 987 if (archetype *at = archetype::find (SPLINT))
1044 if (at)
1045 { 988 {
1046 for (i = 1; i < 9; i++) 989 for (i = 1; i < 9; i++)
1047 { 990 {
1048 if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i])) 991 if (out_of_map (op->map, op->x + freearr_x[i], op->y + freearr_x[i]))
1049 continue; 992 continue;
993
1050 tmp = arch_to_object (at); 994 tmp = arch_to_object (at);
1051 tmp->direction = i; 995 tmp->direction = i;
1052 tmp->range = op->range; 996 tmp->range = op->range;
1053 tmp->stats.dam = op->stats.dam; 997 tmp->stats.dam = op->stats.dam;
1054 tmp->duration = op->duration; 998 tmp->duration = op->duration;
1055 tmp->attacktype = op->attacktype; 999 tmp->attacktype = op->attacktype;
1056 copy_owner (tmp, op); 1000 tmp->set_owner (op);
1057 if (op->skill && op->skill != tmp->skill) 1001 if (op->skill && op->skill != tmp->skill)
1058 {
1059 tmp->skill = op->skill; 1002 tmp->skill = op->skill;
1060 } 1003
1061 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE)) 1004 if (QUERY_FLAG (tmp, FLAG_IS_TURNABLE))
1062 SET_ANIMATION (tmp, i); 1005 SET_ANIMATION (tmp, i);
1063 tmp->x = op->x + freearr_x[i]; 1006
1064 tmp->y = op->y + freearr_x[i]; 1007 op->map->insert (tmp, op->x + freearr_x[i], op->y + freearr_x[i], op);
1065 insert_ob_in_map (tmp, op->map, op, 0);
1066 move_bullet (tmp); 1008 move_bullet (tmp);
1067 } 1009 }
1068 } 1010 }
1069 1011
1070 explode_bullet (op); 1012 explode_bullet (op);
1075{ 1017{
1076 1018
1077 object *tmp; 1019 object *tmp;
1078 int mflags; 1020 int mflags;
1079 sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir]; 1021 sint16 dx = op->x + freearr_x[dir], dy = op->y + freearr_y[dir];
1080 mapstruct *m; 1022 maptile *m;
1081 1023
1082 mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy); 1024 mflags = get_map_flags (op->map, &m, dx, dy, &dx, &dy);
1083 if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK)) 1025 if ((mflags & P_OUT_OF_MAP) || (GET_MAP_MOVE_BLOCK (m, dx, dy) & MOVE_WALK))
1084 { 1026 {
1085 new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way."); 1027 new_draw_info (NDI_UNIQUE, 0, op, "There is something in the way.");
1091 tmp->range = spell->range + SP_level_range_adjust (caster, spell); 1033 tmp->range = spell->range + SP_level_range_adjust (caster, spell);
1092 tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); 1034 tmp->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell);
1093 tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell); 1035 tmp->duration = spell->duration + SP_level_duration_adjust (caster, spell);
1094 tmp->attacktype = spell->attacktype; 1036 tmp->attacktype = spell->attacktype;
1095 1037
1096 set_owner (tmp, op); 1038 tmp->set_owner (op);
1097 set_spell_skill (op, caster, spell, tmp); 1039 set_spell_skill (op, caster, spell, tmp);
1098 tmp->x = dx; 1040
1099 tmp->y = dy; 1041 m->insert (tmp, dx, dy, op);
1100 insert_ob_in_map (tmp, m, op, 0);
1101 return 1; 1042 return 1;
1102} 1043}
1103 1044
1104/**************************************************************************** 1045/****************************************************************************
1105 * 1046 *
1121get_pointed_target (object *op, int dir, int range, int type) 1062get_pointed_target (object *op, int dir, int range, int type)
1122{ 1063{
1123 object *target; 1064 object *target;
1124 sint16 x, y; 1065 sint16 x, y;
1125 int dist, mflags; 1066 int dist, mflags;
1126 mapstruct *mp; 1067 maptile *mp;
1127 1068
1128 if (dir == 0) 1069 if (dir == 0)
1129 return NULL; 1070 return NULL;
1130 1071
1131 for (dist = 1; dist < range; dist++) 1072 for (dist = 1; dist < range; dist++)
1144 if (GET_MAP_MOVE_BLOCK (mp, x, y) & MOVE_FLY_LOW) 1085 if (GET_MAP_MOVE_BLOCK (mp, x, y) & MOVE_FLY_LOW)
1145 return NULL; 1086 return NULL;
1146 1087
1147 if (mflags & P_IS_ALIVE) 1088 if (mflags & P_IS_ALIVE)
1148 { 1089 {
1149 for (target = get_map_ob (mp, x, y); target; target = target->above) 1090 for (target = GET_MAP_OB (mp, x, y); target; target = target->above)
1150 { 1091 {
1151 if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER)) 1092 if (QUERY_FLAG (target->head ? target->head : target, FLAG_MONSTER))
1152 { 1093 {
1153 return target; 1094 return target;
1154 } 1095 }
1221 if (effect->attacktype & AT_DEATH) 1162 if (effect->attacktype & AT_DEATH)
1222 { 1163 {
1223 effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell); 1164 effect->level = spell->stats.dam + SP_level_dam_adjust (caster, spell);
1224 1165
1225 /* casting death spells at undead isn't a good thing */ 1166 /* casting death spells at undead isn't a good thing */
1226 if QUERY_FLAG
1227 (target, FLAG_UNDEAD) 1167 if (QUERY_FLAG (target, FLAG_UNDEAD))
1228 { 1168 {
1229 if (random_roll (0, 2, op, PREFER_LOW)) 1169 if (random_roll (0, 2, op, PREFER_LOW))
1230 { 1170 {
1231 new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!"); 1171 new_draw_info (NDI_UNIQUE, 0, op, "Idiot! Your spell boomerangs!");
1232 effect->x = op->x; 1172 effect->x = op->x;
1234 } 1174 }
1235 else 1175 else
1236 { 1176 {
1237 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s looks stronger!", query_name (target)); 1177 new_draw_info_format (NDI_UNIQUE, 0, op, "The %s looks stronger!", query_name (target));
1238 target->stats.hp = target->stats.maxhp * 2; 1178 target->stats.hp = target->stats.maxhp * 2;
1239 free_object (effect); 1179 effect->destroy ();
1240 return 0; 1180 return 0;
1241 } 1181 }
1242 } 1182 }
1243 } 1183 }
1244 else 1184 else
1245 { 1185 {
1246 /* how much woe to inflict :) */ 1186 /* how much woe to inflict :) */
1247 effect->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); 1187 effect->stats.dam = spell->stats.dam + SP_level_dam_adjust (caster, spell);
1248 } 1188 }
1249 1189
1250 set_owner (effect, op); 1190 effect->set_owner (op);
1251 set_spell_skill (op, caster, spell, effect); 1191 set_spell_skill (op, caster, spell, effect);
1252 1192
1253 /* ok, tell it where to be, and insert! */ 1193 /* ok, tell it where to be, and insert! */
1254 effect->x = target->x; 1194 effect->insert_at (target, op);
1255 effect->y = target->y;
1256 insert_ob_in_map (effect, target->map, op, 0);
1257 1195
1258 return 1; 1196 return 1;
1259} 1197}
1260 1198
1261 1199
1271move_missile (object *op) 1209move_missile (object *op)
1272{ 1210{
1273 int i, mflags; 1211 int i, mflags;
1274 object *owner; 1212 object *owner;
1275 sint16 new_x, new_y; 1213 sint16 new_x, new_y;
1276 mapstruct *m; 1214 maptile *m;
1277 1215
1278 if (op->range-- <= 0) 1216 if (op->range-- <= 0)
1279 { 1217 {
1280 remove_ob (op); 1218 op->destroy ();
1281 free_object (op);
1282 return; 1219 return;
1283 } 1220 }
1284 1221
1285 owner = get_owner (op); 1222 owner = op->owner;
1286#if 0 1223#if 0
1287 /* It'd make things nastier if this wasn't here - spells cast by 1224 /* It'd make things nastier if this wasn't here - spells cast by
1288 * monster that are then killed would continue to survive 1225 * monster that are then killed would continue to survive
1289 */ 1226 */
1290 if (owner == NULL) 1227 if (owner == NULL)
1291 { 1228 {
1292 remove_ob (op); 1229 op->destroy ();
1293 free_object (op);
1294 return; 1230 return;
1295 } 1231 }
1296#endif 1232#endif
1297 1233
1298 new_x = op->x + DIRX (op); 1234 new_x = op->x + DIRX (op);
1300 1236
1301 mflags = get_map_flags (op->map, &m, new_x, new_y, &new_x, &new_y); 1237 mflags = get_map_flags (op->map, &m, new_x, new_y, &new_x, &new_y);
1302 1238
1303 if (!(mflags & P_OUT_OF_MAP) && ((mflags & P_IS_ALIVE) || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y)))) 1239 if (!(mflags & P_OUT_OF_MAP) && ((mflags & P_IS_ALIVE) || OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, new_x, new_y))))
1304 { 1240 {
1305 tag_t tag = op->count;
1306
1307 hit_map (op, op->direction, AT_MAGIC, 1); 1241 hit_map (op, op->direction, AT_MAGIC, 1);
1308 /* Basically, missile only hits one thing then goes away. 1242 /* Basically, missile only hits one thing then goes away.
1309 * we need to remove it if someone hasn't already done so. 1243 * we need to remove it if someone hasn't already done so.
1310 */ 1244 */
1311 if (!was_destroyed (op, tag)) 1245 if (!op->destroyed ())
1312 { 1246 op->destroy ();
1313 remove_ob (op); 1247
1314 free_object (op);
1315 }
1316 return; 1248 return;
1317 } 1249 }
1318 1250
1319 remove_ob (op); 1251 op->remove ();
1252
1320 if (!op->direction || (mflags & P_OUT_OF_MAP)) 1253 if (!op->direction || (mflags & P_OUT_OF_MAP))
1321 { 1254 {
1322 free_object (op); 1255 op->destroy ();
1323 return; 1256 return;
1324 } 1257 }
1325 op->x = new_x; 1258
1326 op->y = new_y; 1259 i = spell_find_dir (m, new_x, new_y, op->owner);
1327 op->map = m;
1328 i = spell_find_dir (op->map, op->x, op->y, get_owner (op));
1329 if (i > 0 && i != op->direction) 1260 if (i > 0 && i != op->direction)
1330 { 1261 {
1331 op->direction = i; 1262 op->direction = i;
1332 SET_ANIMATION (op, op->direction); 1263 SET_ANIMATION (op, op->direction);
1333 } 1264 }
1334 insert_ob_in_map (op, op->map, op, 0); 1265
1266 m->insert (op, new_x, new_y, op);
1335} 1267}
1336 1268
1337/**************************************************************************** 1269/****************************************************************************
1338 * Destruction 1270 * Destruction
1339 ****************************************************************************/ 1271 ****************************************************************************/
1384int 1316int
1385cast_destruction (object *op, object *caster, object *spell_ob) 1317cast_destruction (object *op, object *caster, object *spell_ob)
1386{ 1318{
1387 int i, j, range, mflags, friendly = 0, dam, dur; 1319 int i, j, range, mflags, friendly = 0, dam, dur;
1388 sint16 sx, sy; 1320 sint16 sx, sy;
1389 mapstruct *m; 1321 maptile *m;
1390 object *tmp; 1322 object *tmp;
1391 const char *skill; 1323 const char *skill;
1392 1324
1393 range = spell_ob->range + SP_level_range_adjust (caster, spell_ob); 1325 range = spell_ob->range + SP_level_range_adjust (caster, spell_ob);
1394 dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob); 1326 dam = spell_ob->stats.dam + SP_level_dam_adjust (caster, spell_ob);
1417 for (j = -range; j < range; j++) 1349 for (j = -range; j < range; j++)
1418 { 1350 {
1419 m = op->map; 1351 m = op->map;
1420 sx = op->x + i; 1352 sx = op->x + i;
1421 sy = op->y + j; 1353 sy = op->y + j;
1354
1422 mflags = get_map_flags (m, &m, sx, sy, &sx, &sy); 1355 mflags = get_map_flags (m, &m, sx, sy, &sx, &sy);
1423 if (mflags & P_OUT_OF_MAP) 1356 if (mflags & P_OUT_OF_MAP)
1424 continue; 1357 continue;
1358
1425 if (mflags & P_IS_ALIVE) 1359 if (mflags & P_IS_ALIVE)
1426 { 1360 {
1427 for (tmp = get_map_ob (m, sx, sy); tmp; tmp = tmp->above) 1361 for (tmp = GET_MAP_OB (m, sx, sy); tmp; tmp = tmp->above)
1428 {
1429 if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER) 1362 if (QUERY_FLAG (tmp, FLAG_ALIVE) || tmp->type == PLAYER)
1430 break; 1363 break;
1431 } 1364
1432 if (tmp) 1365 if (tmp)
1433 { 1366 {
1434 if (tmp->head) 1367 if (tmp->head)
1435 tmp = tmp->head; 1368 tmp = tmp->head;
1436 1369
1439 { 1372 {
1440 if (spell_ob->subtype == SP_DESTRUCTION) 1373 if (spell_ob->subtype == SP_DESTRUCTION)
1441 { 1374 {
1442 hit_player (tmp, dam, op, spell_ob->attacktype, 0); 1375 hit_player (tmp, dam, op, spell_ob->attacktype, 0);
1443 if (spell_ob->other_arch) 1376 if (spell_ob->other_arch)
1444 {
1445 tmp = arch_to_object (spell_ob->other_arch); 1377 m->insert (arch_to_object (spell_ob->other_arch), sx, sy, op);
1446 tmp->x = sx;
1447 tmp->y = sy;
1448 insert_ob_in_map (tmp, m, op, 0);
1449 }
1450 } 1378 }
1451 else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist[ATNR_MAGIC] != 100) 1379 else if (spell_ob->subtype == SP_FAERY_FIRE && tmp->resist[ATNR_MAGIC] != 100)
1452 { 1380 {
1453 if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch) 1381 if (make_object_glow (tmp, 1, dur) && spell_ob->other_arch)
1454 {
1455 object *effect = arch_to_object (spell_ob->other_arch); 1382 m->insert (arch_to_object (spell_ob->other_arch), sx, sy, op);
1456
1457 effect->x = sx;
1458 effect->y = sy;
1459 insert_ob_in_map (effect, m, op, 0);
1460 }
1461 } 1383 }
1462 } 1384 }
1463 } 1385 }
1464 } 1386 }
1465 } 1387 }
1466 } 1388 }
1389
1467 op->skill = skill; 1390 op->skill = skill;
1468 return 1; 1391 return 1;
1469} 1392}
1470 1393
1471/*************************************************************************** 1394/***************************************************************************
1555 force->stats.ac = spell_ob->stats.ac; 1478 force->stats.ac = spell_ob->stats.ac;
1556 force->stats.wc = spell_ob->stats.wc; 1479 force->stats.wc = spell_ob->stats.wc;
1557 1480
1558 change_abil (tmp, force); /* Mostly to display any messages */ 1481 change_abil (tmp, force); /* Mostly to display any messages */
1559 insert_ob_in_ob (force, tmp); 1482 insert_ob_in_ob (force, tmp);
1560 fix_player (tmp); 1483 tmp->update_stats ();
1561 return 1; 1484 return 1;
1562 1485
1563} 1486}
1564 1487
1565 1488
1576mood_change (object *op, object *caster, object *spell) 1499mood_change (object *op, object *caster, object *spell)
1577{ 1500{
1578 object *tmp, *god, *head; 1501 object *tmp, *god, *head;
1579 int done_one, range, mflags, level, at, best_at; 1502 int done_one, range, mflags, level, at, best_at;
1580 sint16 x, y, nx, ny; 1503 sint16 x, y, nx, ny;
1581 mapstruct *m; 1504 maptile *m;
1582 const char *race; 1505 const char *race;
1583 1506
1584 /* We precompute some values here so that we don't have to keep 1507 /* We precompute some values here so that we don't have to keep
1585 * doing it over and over again. 1508 * doing it over and over again.
1586 */ 1509 */
1616 1539
1617 /* If there is nothing living on this space, no need to go further */ 1540 /* If there is nothing living on this space, no need to go further */
1618 if (!(mflags & P_IS_ALIVE)) 1541 if (!(mflags & P_IS_ALIVE))
1619 continue; 1542 continue;
1620 1543
1621 for (tmp = get_map_ob (m, nx, ny); tmp; tmp = tmp->above) 1544 for (tmp = GET_MAP_OB (m, nx, ny); tmp; tmp = tmp->above)
1622 if (QUERY_FLAG (tmp, FLAG_MONSTER)) 1545 if (QUERY_FLAG (tmp, FLAG_MONSTER))
1623 break; 1546 break;
1624 1547
1625 /* There can be living objects that are not monsters */ 1548 /* There can be living objects that are not monsters */
1626 if (!tmp || tmp->type == PLAYER) 1549 if (!tmp || tmp->type == PLAYER)
1706 if (QUERY_FLAG (spell, FLAG_BERSERK) && !QUERY_FLAG (head, FLAG_BERSERK)) 1629 if (QUERY_FLAG (spell, FLAG_BERSERK) && !QUERY_FLAG (head, FLAG_BERSERK))
1707 { 1630 {
1708 SET_FLAG (head, FLAG_BERSERK); 1631 SET_FLAG (head, FLAG_BERSERK);
1709 done_one = 1; 1632 done_one = 1;
1710 } 1633 }
1634
1711 /* charm */ 1635 /* charm */
1712 if (QUERY_FLAG (spell, FLAG_NO_ATTACK) && !QUERY_FLAG (head, FLAG_FRIENDLY)) 1636 if (QUERY_FLAG (spell, FLAG_NO_ATTACK) && !QUERY_FLAG (head, FLAG_FRIENDLY))
1713 { 1637 {
1714 SET_FLAG (head, FLAG_FRIENDLY);
1715 /* Prevent uncontolled outbreaks of self replicating monsters. 1638 /* Prevent uncontolled outbreaks of self replicating monsters.
1716 Typical use case is charm, go somwhere, use aggravation to make hostile. 1639 Typical use case is charm, go somwhere, use aggravation to make hostile.
1717 This could lead to fun stuff like mice outbreak in bigworld and server crawl. */ 1640 This could lead to fun stuff like mice outbreak in bigworld and server crawl. */
1718 CLEAR_FLAG (head, FLAG_GENERATOR); 1641 CLEAR_FLAG (head, FLAG_GENERATOR);
1719 set_owner (head, op); 1642 head->set_owner (op);
1720 set_spell_skill (op, caster, spell, head); 1643 set_spell_skill (op, caster, spell, head);
1721 add_friendly_object (head); 1644 add_friendly_object (head);
1722 head->attack_movement = PETMOVE; 1645 head->attack_movement = PETMOVE;
1723 done_one = 1; 1646 done_one = 1;
1724 change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL); 1647 change_exp (op, head->stats.exp / 2, head->skill, SK_EXP_ADD_SKILL);
1725 head->stats.exp = 0; 1648 head->stats.exp = 0;
1726 } 1649 }
1727 1650
1728 /* If a monster was effected, put an effect in */ 1651 /* If a monster was effected, put an effect in */
1729 if (done_one && spell->other_arch) 1652 if (done_one && spell->other_arch)
1730 {
1731 tmp = arch_to_object (spell->other_arch); 1653 m->insert (arch_to_object (spell->other_arch), nx, ny, op);
1732 tmp->x = nx;
1733 tmp->y = ny;
1734 insert_ob_in_map (tmp, m, op, 0);
1735 }
1736 } /* for y */ 1654 } /* for y */
1737 1655
1738 return 1; 1656 return 1;
1739} 1657}
1740 1658
1750move_ball_spell (object *op) 1668move_ball_spell (object *op)
1751{ 1669{
1752 int i, j, dam_save, dir, mflags; 1670 int i, j, dam_save, dir, mflags;
1753 sint16 nx, ny, hx, hy; 1671 sint16 nx, ny, hx, hy;
1754 object *owner; 1672 object *owner;
1755 mapstruct *m; 1673 maptile *m;
1756 1674
1757 owner = get_owner (op); 1675 owner = op->owner;
1758 1676
1759 /* the following logic makes sure that the ball doesn't move into a wall, 1677 /* the following logic makes sure that the ball doesn't move into a wall,
1760 * and makes sure that it will move along a wall to try and get at it's 1678 * and makes sure that it will move along a wall to try and get at it's
1761 * victim. The block immediately below more or less chooses a random 1679 * victim. The block immediately below more or less chooses a random
1762 * offset to move the ball, eg, keep it mostly on course, with some 1680 * offset to move the ball, eg, keep it mostly on course, with some
1791 nx = op->x; 1709 nx = op->x;
1792 ny = op->y; 1710 ny = op->y;
1793 m = op->map; 1711 m = op->map;
1794 } 1712 }
1795 1713
1796 remove_ob (op); 1714 m->insert (op, nx, ny, op);
1797 op->y = ny;
1798 op->x = nx;
1799 insert_ob_in_map (op, m, op, 0);
1800 1715
1801 dam_save = op->stats.dam; /* save the original dam: we do halfdam on 1716 dam_save = op->stats.dam; /* save the original dam: we do halfdam on
1802 surrounding squares */ 1717 surrounding squares */
1803 1718
1804 /* loop over current square and neighbors to hit. 1719 /* loop over current square and neighbors to hit.
1830 1745
1831 } 1746 }
1832 1747
1833 /* insert the other arch */ 1748 /* insert the other arch */
1834 if (op->other_arch && !(OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, hx, hy)))) 1749 if (op->other_arch && !(OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, hx, hy))))
1835 { 1750 m->insert (arch_to_object (op->other_arch), hx, hy, op);
1836 new_ob = arch_to_object (op->other_arch);
1837 new_ob->x = hx;
1838 new_ob->y = hy;
1839 insert_ob_in_map (new_ob, m, op, 0);
1840 }
1841 } 1751 }
1842 1752
1843 /* restore to the center location and damage */ 1753 /* restore to the center location and damage */
1844 op->stats.dam = dam_save; 1754 op->stats.dam = dam_save;
1845 1755
1846 i = spell_find_dir (op->map, op->x, op->y, get_owner (op)); 1756 i = spell_find_dir (op->map, op->x, op->y, op->owner);
1847 1757
1848 if (i >= 0) 1758 if (i >= 0)
1849 { /* we have a preferred direction! */ 1759 { /* we have a preferred direction! */
1850 /* pick another direction if the preferred dir is blocked. */ 1760 /* pick another direction if the preferred dir is blocked. */
1851 if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP || 1761 if (get_map_flags (op->map, &m, nx + freearr_x[i], ny + freearr_y[i], &hx, &hy) & P_OUT_OF_MAP ||
1852 OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, hx, hy))) 1762 OB_TYPE_MOVE_BLOCK (op, GET_MAP_MOVE_BLOCK (m, hx, hy)))
1853 {
1854 i = absdir (i + rndm (0, 2) - 1); /* -1, 0, +1 */ 1763 i = absdir (i + rndm (0, 2) - 1); /* -1, 0, +1 */
1855 } 1764
1856 op->direction = i; 1765 op->direction = i;
1857 } 1766 }
1858} 1767}
1859 1768
1860 1769
1872#if 0 1781#if 0
1873 static int cardinal_adjust[9] = { -3, -2, -1, 0, 0, 0, 1, 2, 3 }; 1782 static int cardinal_adjust[9] = { -3, -2, -1, 0, 0, 0, 1, 2, 3 };
1874 static int diagonal_adjust[10] = { -3, -2, -2, -1, 0, 0, 1, 2, 2, 3 }; 1783 static int diagonal_adjust[10] = { -3, -2, -2, -1, 0, 0, 1, 2, 2, 3 };
1875 sint16 target_x, target_y, origin_x, origin_y; 1784 sint16 target_x, target_y, origin_x, origin_y;
1876 int adjustdir; 1785 int adjustdir;
1877 mapstruct *m; 1786 maptile *m;
1878#endif 1787#endif
1879 int basedir; 1788 int basedir;
1880 object *owner; 1789 object *owner;
1881 1790
1882 owner = get_owner (op); 1791 owner = op->owner;
1883 if (op->duration == 0 || owner == NULL) 1792 if (op->duration == 0 || owner == NULL)
1884 { 1793 {
1885 remove_ob (op); 1794 op->destroy ();
1886 free_object (op);
1887 return; 1795 return;
1888 } 1796 }
1797
1889 op->duration--; 1798 op->duration--;
1890 1799
1891 basedir = op->direction; 1800 basedir = op->direction;
1892 if (basedir == 0) 1801 if (basedir == 0)
1893 { 1802 {
1990 1899
1991 if (!spell->other_arch) 1900 if (!spell->other_arch)
1992 return 0; 1901 return 0;
1993 1902
1994 tmp = get_archetype (SWARM_SPELL); 1903 tmp = get_archetype (SWARM_SPELL);
1995 tmp->x = op->x;
1996 tmp->y = op->y;
1997 set_owner (tmp, op); /* needed so that if swarm elements kill, caster gets xp. */ 1904 tmp->set_owner (op); /* needed so that if swarm elements kill, caster gets xp. */
1998 set_spell_skill (op, caster, spell, tmp); 1905 set_spell_skill (op, caster, spell, tmp);
1999 1906
2000 tmp->level = caster_level (caster, spell); /*needed later, to get level dep. right. */ 1907 tmp->level = caster_level (caster, spell); /*needed later, to get level dep. right. */
2001 tmp->spell = arch_to_object (spell->other_arch); 1908 tmp->spell = arch_to_object (spell->other_arch);
2002 1909
2003 tmp->attacktype = tmp->spell->attacktype; 1910 tmp->attacktype = tmp->spell->attacktype;
2004 1911
2005 if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER) 1912 if (tmp->attacktype & AT_HOLYWORD || tmp->attacktype & AT_GODPOWER)
2006 {
2007 if (!tailor_god_spell (tmp, op)) 1913 if (!tailor_god_spell (tmp, op))
2008 return 1; 1914 return 1;
2009 } 1915
2010 tmp->duration = SP_level_duration_adjust (caster, spell); 1916 tmp->duration = SP_level_duration_adjust (caster, spell);
2011 for (i = 0; i < spell->duration; i++) 1917 for (i = 0; i < spell->duration; i++)
2012 tmp->duration += die_roll (1, 3, op, PREFER_HIGH); 1918 tmp->duration += die_roll (1, 3, op, PREFER_HIGH);
2013 1919
2014 tmp->direction = dir; 1920 tmp->direction = dir;
2015 tmp->invisible = 1; 1921 tmp->invisible = 1;
2016 insert_ob_in_map (tmp, op->map, op, 0); 1922
1923 tmp->insert_at (op, op);
2017 return 1; 1924 return 1;
2018} 1925}
2019 1926
2020 1927
2021/* See the spells documentation file for why this is its own 1928/* See the spells documentation file for why this is its own
2025cast_light (object *op, object *caster, object *spell, int dir) 1932cast_light (object *op, object *caster, object *spell, int dir)
2026{ 1933{
2027 object *target = NULL, *tmp = NULL; 1934 object *target = NULL, *tmp = NULL;
2028 sint16 x, y; 1935 sint16 x, y;
2029 int dam, mflags; 1936 int dam, mflags;
2030 mapstruct *m; 1937 maptile *m;
2031 1938
2032 dam = spell->stats.dam + SP_level_dam_adjust (caster, spell); 1939 dam = spell->stats.dam + SP_level_dam_adjust (caster, spell);
2033 1940
2034 if (!dir) 1941 if (!dir)
2035 { 1942 {
2049 return 0; 1956 return 0;
2050 } 1957 }
2051 1958
2052 if (mflags & P_IS_ALIVE && spell->attacktype) 1959 if (mflags & P_IS_ALIVE && spell->attacktype)
2053 { 1960 {
2054 for (target = get_map_ob (m, x, y); target; target = target->above) 1961 for (target = GET_MAP_OB (m, x, y); target; target = target->above)
2055 if (QUERY_FLAG (target, FLAG_MONSTER)) 1962 if (QUERY_FLAG (target, FLAG_MONSTER))
2056 { 1963 {
2057 /* oky doky. got a target monster. Lets make a blinding attack */ 1964 /* oky doky. got a target monster. Lets make a blinding attack */
2058 if (target->head) 1965 if (target->head)
2059 target = target->head; 1966 target = target->head;
2081 { 1988 {
2082 tmp->glow_radius = spell->range + SP_level_range_adjust (caster, spell); 1989 tmp->glow_radius = spell->range + SP_level_range_adjust (caster, spell);
2083 if (tmp->glow_radius > MAX_LIGHT_RADII) 1990 if (tmp->glow_radius > MAX_LIGHT_RADII)
2084 tmp->glow_radius = MAX_LIGHT_RADII; 1991 tmp->glow_radius = MAX_LIGHT_RADII;
2085 } 1992 }
2086 tmp->x = x; 1993
2087 tmp->y = y; 1994 m->insert (tmp, x, y, op);
2088 insert_ob_in_map (tmp, m, op, 0);
2089 return 1; 1995 return 1;
2090} 1996}
2091 1997
2092 1998
2093 1999
2103cast_cause_disease (object *op, object *caster, object *spell, int dir) 2009cast_cause_disease (object *op, object *caster, object *spell, int dir)
2104{ 2010{
2105 sint16 x, y; 2011 sint16 x, y;
2106 int i, mflags, range, dam_mod, dur_mod; 2012 int i, mflags, range, dam_mod, dur_mod;
2107 object *walk; 2013 object *walk;
2108 mapstruct *m; 2014 maptile *m;
2109 2015
2110 x = op->x; 2016 x = op->x;
2111 y = op->y; 2017 y = op->y;
2112 2018
2113 /* If casting from a scroll, no direction will be available, so refer to the 2019 /* If casting from a scroll, no direction will be available, so refer to the
2141 2047
2142 /* Only bother looking on this space if there is something living here */ 2048 /* Only bother looking on this space if there is something living here */
2143 if (mflags & P_IS_ALIVE) 2049 if (mflags & P_IS_ALIVE)
2144 { 2050 {
2145 /* search this square for a victim */ 2051 /* search this square for a victim */
2146 for (walk = get_map_ob (m, x, y); walk; walk = walk->above) 2052 for (walk = GET_MAP_OB (m, x, y); walk; walk = walk->above)
2147 if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER)) 2053 if (QUERY_FLAG (walk, FLAG_MONSTER) || (walk->type == PLAYER))
2148 { /* found a victim */ 2054 { /* found a victim */
2149 object *disease = arch_to_object (spell->other_arch); 2055 object *disease = arch_to_object (spell->other_arch);
2150 2056
2151 set_owner (disease, op); 2057 disease->set_owner (op);
2152 set_spell_skill (op, caster, spell, disease); 2058 set_spell_skill (op, caster, spell, disease);
2153 disease->stats.exp = 0; 2059 disease->stats.exp = 0;
2154 disease->level = caster_level (caster, spell); 2060 disease->level = caster_level (caster, spell);
2155 2061
2156 /* do level adjustments */ 2062 /* do level adjustments */
2205 { 2111 {
2206 object *flash; /* visual effect for inflicting disease */ 2112 object *flash; /* visual effect for inflicting disease */
2207 2113
2208 new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name); 2114 new_draw_info_format (NDI_UNIQUE, 0, op, "You inflict %s on %s!", &disease->name, &walk->name);
2209 2115
2210 free_object (disease); /* don't need this one anymore */ 2116 disease->destroy (); /* don't need this one anymore */
2211 flash = get_archetype (ARCH_DETECT_MAGIC); 2117 walk->map->insert (get_archetype (ARCH_DETECT_MAGIC), x, y, op);
2212 flash->x = x;
2213 flash->y = y;
2214 flash->map = walk->map;
2215 insert_ob_in_map (flash, walk->map, op, 0);
2216 return 1; 2118 return 1;
2217 } 2119 }
2218 free_object (disease); 2120
2121 disease->destroy ();
2219 } 2122 }
2220 } /* if living creature */ 2123 } /* if living creature */
2221 } /* for range of spaces */ 2124 } /* for range of spaces */
2125
2222 new_draw_info (NDI_UNIQUE, 0, op, "No one caught anything!"); 2126 new_draw_info (NDI_UNIQUE, 0, op, "No one caught anything!");
2223 return 1; 2127 return 1;
2224} 2128}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines