Annoying Bug.......

From: Chuck Carson (chuck@DIGMO.ORG)
Date: 12/18/97


Can anyone help me figure this out? The mud crashes every time a mob hits a
death trap (now that I think about it, I believe only mobs with one of the
below bits set, AGGR's). Here is the code causing the crash. This is stock
code except for the intial if statement, I have added the 128 bit vector
code and must test each flag individually (instead of MOB_FLAGGED(ch, XXXX |
XXXXXX)). This however is unrelated. The mud has no problem getting by this
line. When it enters the for loop, crashola. This code, from the binary
level, should be no different than the stock code. This is driving me crazy.

    /* Aggressive Mobs */
    if ((MOB_FLAGGED(ch, MOB_AGGRESSIVE)) || (MOB_FLAGGED(ch,
MOB_AGGR_TO_ALIGN)))
      found = FALSE;
PROBLEM:for (vict = world[ch->in_room].people ; vict && !found; vict =
vict_next) {
        if (IS_NPC(vict) || !CAN_SEE(ch, vict) || PRF_FLAGGED(vict,
PRF_NOHASSLE))
          continue;
        if (MOB_FLAGGED(ch, MOB_WIMPY) && AWAKE(vict))
          continue;
        if (!MOB_FLAGGED(ch, MOB_AGGR_TO_ALIGN) ||
            (MOB_FLAGGED(ch, MOB_AGGR_EVIL) && IS_EVIL(vict)) ||
            (MOB_FLAGGED(ch, MOB_AGGR_NEUTRAL) && IS_NEUTRAL(vict)) ||
            (MOB_FLAGGED(ch, MOB_AGGR_GOOD) && IS_GOOD(vict))) {
          hit(ch, vict, TYPE_UNDEFINED);
          found = TRUE;
          vict_next = vict->next_in_room;
        }
      }
    }

Here is the useless gdb output:
/home/chuck/circle/src ===>gdb ../bin/circle ../lib/core
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "show copying" to see the conditions.
There is absolutely no warranty for GDB; type "show warranty" for details.
GDB 4.16 (i486-slackware-linux), Copyright 1996 Free Software Foundation,
Inc...
Core was generated by `bin/circle 9999'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libc.so.5...done.
Reading symbols from /lib/ld-linux.so.1...done.
#0  0x8073e5a in mobile_activity () at mobact.c:95
Source file is more recent than executable.
95            for (vict = world[ch->in_room].people ; vict && !found; vict =
vict_next) {
(gdb) back
#0  0x8073e5a in mobile_activity () at mobact.c:95
#1  0x8049e98 in heartbeat (pulse=400) at comm.c:699
#2  0x8049e12 in game_loop (mother_desc=3) at comm.c:674
#3  0x804949e in init_game (port=9999) at comm.c:267
#4  0x8049430 in main (argc=2, argv=0xbffffb84) at comm.c:237
#5  0x804915e in _start ()
(gdb) quit


I am sure it is a null pointer crash bug but why? Why is this error not
occuring in the stock version of the code. Can my problem lie elsewhere?
This is a rather top level function so this leaves me empty handed. What
really irkes the shit out of me as it only happens in death trap rooms. I
could understand this crash if it occured for any mob in any room, but this
crash bug eludes me. Just curious, how many people use the 128 bit vector
code without problems. I tried this code 1 1/2 years ago in a heavily
altered bpl11 and eventually gave up and am now trying it in a stock bpl 12.
(although I have been away from circle for a year working on rom and am a
bit fuzzy) There are no players in the room when this for loop executes so
why is it executing the loop? I am he only char logged into the game when
this occurs and it also occurs if no one has logged in.

Thanks in adavance for any help,
Chuck


     +------------------------------------------------------------+
     | 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