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

Comparing deliantra/server/server/pets.C (file contents):
Revision 1.9 by root, Thu Sep 14 22:34:04 2006 UTC vs.
Revision 1.10 by root, Thu Sep 14 23:13:49 2006 UTC

333} 333}
334 334
335void 335void
336pet_move (object *ob) 336pet_move (object *ob)
337{ 337{
338 int dir, tag, i; 338 int dir, i;
339 sint16 dx, dy; 339 sint16 dx, dy;
340 object *ob2, *owner; 340 object *ob2, *owner;
341 mapstruct *m; 341 mapstruct *m;
342 342
343 /* Check to see if player pulled out */ 343 /* Check to see if player pulled out */
381 get_rangevector (ob, ob->owner, &rv, 0); 381 get_rangevector (ob, ob->owner, &rv, 0);
382 dir = rv.direction; 382 dir = rv.direction;
383 } 383 }
384 ob->direction = dir; 384 ob->direction = dir;
385 385
386 tag = ob->count;
387 /* move_ob returns 0 if the object couldn't move. If that is the 386 /* move_ob returns 0 if the object couldn't move. If that is the
388 * case, lets do some other work. 387 * case, lets do some other work.
389 */ 388 */
390 if (!(move_ob (ob, dir, ob))) 389 if (!(move_ob (ob, dir, ob)))
391 { 390 {
392 object *part; 391 object *part;
393 392
394 /* the failed move_ob above may destroy the pet, so check here */ 393 /* the failed move_ob above may destroy the pet, so check here */
395 if (was_destroyed (ob, tag)) 394 if (ob->destroyed ())
396 return; 395 return;
397 396
398 for (part = ob; part != NULL; part = part->more) 397 for (part = ob; part != NULL; part = part->more)
399 { 398 {
400 dx = part->x + freearr_x[dir]; 399 dx = part->x + freearr_x[dir];
538void 537void
539move_golem (object *op) 538move_golem (object *op)
540{ 539{
541 int made_attack = 0; 540 int made_attack = 0;
542 object *tmp; 541 object *tmp;
543 tag_t tag;
544 542
545 if (QUERY_FLAG (op, FLAG_MONSTER)) 543 if (QUERY_FLAG (op, FLAG_MONSTER))
546 return; /* Has already been moved */ 544 return; /* Has already been moved */
547 545
548 if (get_owner (op) == NULL) 546 if (get_owner (op) == NULL)
550 LOG (llevDebug, "Golem without owner destructed.\n"); 548 LOG (llevDebug, "Golem without owner destructed.\n");
551 remove_ob (op); 549 remove_ob (op);
552 free_object (op); 550 free_object (op);
553 return; 551 return;
554 } 552 }
553
555 /* It would be nice to have a cleaner way of what message to print 554 /* It would be nice to have a cleaner way of what message to print
556 * when the golem expires than these hard coded entries. 555 * when the golem expires than these hard coded entries.
557 * Note it is intentional that a golems duration is based on its 556 * Note it is intentional that a golems duration is based on its
558 * hp, and not duration 557 * hp, and not duration
559 */ 558 */
572 /* Do golem attacks/movement for single & multisq golems. 571 /* Do golem attacks/movement for single & multisq golems.
573 * Assuming here that op is the 'head' object. Pass only op to 572 * Assuming here that op is the 'head' object. Pass only op to
574 * move_ob (makes recursive calls to other parts) 573 * move_ob (makes recursive calls to other parts)
575 * move_ob returns 0 if the creature was not able to move. 574 * move_ob returns 0 if the creature was not able to move.
576 */ 575 */
577 tag = op->count;
578 if (move_ob (op, op->direction, op)) 576 if (move_ob (op, op->direction, op))
579 return; 577 return;
580 if (was_destroyed (op, tag)) 578
579 if (op->destroyed ())
581 return; 580 return;
582 581
583 for (tmp = op; tmp; tmp = tmp->more) 582 for (tmp = op; tmp; tmp = tmp->more)
584 { 583 {
585 sint16 x = tmp->x + freearr_x[op->direction], y = tmp->y + freearr_y[op->direction]; 584 sint16 x = tmp->x + freearr_x[op->direction], y = tmp->y + freearr_y[op->direction];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines