Re: perform_mover() problem

From: George (greerga@CIRCLEMUD.ORG)
Date: 03/18/98


On Tue, 10 Mar 1998, Angus Mezick wrote:

>For those of you who use perform_move to have your mobs hunt and such,
>there is a minor problem.  They will leave a fight the next time
>perform_move is called.  Need to add a FIGHTING() check to this function.
>Ran into this when i moved my mob hunting into an event system.  This will
>probably effect that mob_path code that is being developed too....
>careful.

None of the patches I have sent tonight (with the exception of the
con_disconnect patch) are in bpl13 yet, so :P~

diff -uprN -X .exclude stk/act.movement.c perfmove/act.movement.c
--- stk/act.movement.c  Sat Apr 13 20:02:07 1996
+++ perfmove/act.movement.c     Wed Mar 18 21:49:15 1998
@@ -156,7 +156,7 @@ int perform_move(struct char_data *ch, i
   int was_in;
   struct follow_type *k, *next;

-  if (ch == NULL || dir < 0 || dir >= NUM_OF_DIRS)
+  if (ch == NULL || dir < 0 || dir >= NUM_OF_DIRS || FIGHTING(ch))
     return 0;
   else if (!EXIT(ch, dir) || EXIT(ch, dir)->to_room == NOWHERE)
     send_to_char("Alas, you cannot go that way...\r\n", ch);
diff -uprN -X .exclude stk/graph.c perfmove/graph.c
--- stk/graph.c Fri Apr 12 23:39:21 1996
+++ perfmove/graph.c    Wed Mar 18 22:06:59 1998
@@ -211,7 +211,7 @@ void hunt_victim(struct char_data * ch)
   byte found;
   struct char_data *tmp;

-  if (!ch || !HUNTING(ch))
+  if (!ch || !HUNTING(ch) || FIGHTING(ch))
     return;

   /* make sure the char still exists */

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST