Mobile Activity

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 09/30/97


diff -upPr -x *.o ../stk/mobact.c ./mobact.c
--- ../stk/mobact.c     Thu Jun 19 00:58:37 1997
+++ ./mobact.c  Tue Sep 30 15:45:24 1997
@@ -32,16 +32,24 @@ void mobile_activity(void)
 {
   register struct char_data *ch, *next_ch, *vict;
   struct obj_data *obj, *best_obj;
-  int door, found, max;
+  int door, found, max, i;
+  static int mobs_to_run = 0;
   memory_rec *names;

   extern int no_specials;

   ACMD(do_get);

-  for (ch = character_list; ch; ch = next_ch) {
+  if (++mobs_to_run > MOBILE_PERCENT)
+    mobs_to_run = 1;
+
+  for (ch = character_list, i = 1; ch; ch = next_ch, i++) {
     next_ch = ch->next;

+    if (i > MOBILE_PERCENT)
+      i = 1;
+    if (i != mobs_to_run)
+      continue;
     if (!IS_MOB(ch) || FIGHTING(ch) || !AWAKE(ch))
       continue;

diff -upPr -x *.o ../stk/structs.h ./structs.h
--- ../stk/structs.h    Thu Jun 19 00:58:38 1997
+++ ./structs.h Tue Sep 30 15:33:46 1997
@@ -421,8 +421,9 @@
 #define RL_SEC         * PASSES_PER_SEC

 #define PULSE_ZONE      (10 RL_SEC)
-#define PULSE_MOBILE    (10 RL_SEC)
+#define PULSE_MOBILE    (1 RL_SEC)
 #define PULSE_VIOLENCE  (2 RL_SEC)
+#define MOBILE_PERCENT 10  /* Do 1 in 10 of specials per mobile pulse. */

 #define SMALL_BUFSIZE          1024
 #define LARGE_BUFSIZE          (12 * 1024)

It is a small patch to make 1/10th (adjustable) of the mobs go every
second, which still runs every mob special in 10 seconds as usual.  This
does have the penalty of running through the list more often but it doesn't
do as much each time.

Motivated after loading 200 Puff's into a room to test my buffer code and
having them all 'chunk' stuff at 10 second intervals.

I've put it on my page also and will update Dragon after I mail this.

--
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/08/00 PST