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

Comparing deliantra/server/server/monster.C (file contents):
Revision 1.54 by root, Sat Dec 27 04:07:44 2008 UTC vs.
Revision 1.55 by root, Sat Dec 27 07:50:05 2008 UTC

508 508
509 part = rv.part; 509 part = rv.part;
510 dir = rv.direction; 510 dir = rv.direction;
511 511
512#if DEVEL 512#if DEVEL
513 int sdir = 0;
514
513 for (int sdir = 1; sdir <= 8; ++sdir) 515 for (int dir = 1; dir <= 8; ++dir)
514 { 516 {
515 mapxy pos (op); pos.move (sdir); 517 mapxy pos (op); pos.move (dir);
516 if (pos.normalise ()) 518 if (pos.normalise ())
517 { 519 {
518 mapspace &ms = pos.ms (); 520 mapspace &ms = pos.ms ();
519 521
520 if (ms.smell > op->ms ().smell) 522 if (ms.smell > op->ms ().smell)
521 { 523 {
522 printf ("%s: found smell, following it, apparently (%d, %d)\n",& op->name,op->ms().smell,ms.smell);//D 524 printf ("%s: found smell, following it, apparently (%d, %d)\n",& op->name,op->ms().smell,ms.smell);//D
523 op->ms ().smell = ms.smell - 1; 525 op->ms ().smell = ms.smell - 1;
524 dir = sdir; 526 sdir = dir;
527
528 // perturbing the path might let the monster lose track,
529 // but it will also wide the actual path, spreading information
530 if (!rndm (20))
531 sdir += absdir (1 - rndm (2) * 2);
525 } 532 }
526 } 533 }
527 } 534 }
535
536 if (sdir)
537 dir = sdir;
538 else
539 // no better smell found, so assume the player jumped, and erase this smell
540 {if (op->ms ().smell) printf ("erasing smell %d\n", op->ms ().smell);//D
541 ordered_mapwalk_begin (op, -1, -1, 1, 1)
542 if (m)
543 m->at (nx, ny).smell = 0;
544 ordered_mapwalk_end
545 }//D
546
528#endif 547#endif
529 548
530 if (QUERY_FLAG (op, FLAG_SCARED) || QUERY_FLAG (op, FLAG_RUN_AWAY)) 549 if (QUERY_FLAG (op, FLAG_SCARED) || QUERY_FLAG (op, FLAG_RUN_AWAY))
531 dir = absdir (dir + 4); 550 dir = absdir (dir + 4);
532 551

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines