[NEWBIE] [CODE] Adding EQ position

From: Bradley D. Hartin (bhartin@MA909A.TAMUCC.EDU)
Date: 04/16/98

My apologies for the length of the message, but I figured I'd be

I've been trying to add dual-wield code, and ended up causing segv
crashes.  I went back to the code before I started this, and did it step
by step, testing each change.  I finally narrowed it down to something
related to adding the eq slot.  The changes I'm listing below are the ONLY
changes made between the stable and unstable code.  The crash occurs on
the death of a mob, and appears that the followers list for the victim is
getting messed up.  My guess is some sort of OOB error, but I'm clueless
where it is.  My thought is I'm missing something in adding the eq slot.
Can anyone point out if I have please?

  #define WEAR_WRIST_L   15
  #define WEAR_WIELD     16
  #define WEAR_HOLD      17
+ #define WEAR_WIELD_S   18
! #define NUM_WEARS      19     /* This must be the # of eq positions!! */

    "<worn around wrist>  ",
!   "<primary weapon>     ",
!   "<held>               ",
+   "<secondary weapon>   "
    "Worn around left wrist",
!   "Wielded primary",
+   "Wielded secondary",

At this point I've simply added the eq slot..I have not added the code for
actually wielding.  But the changes above seem to be causing my problems.
I am open to the fact that this simply uncovered a problem that already
exists--but I might as well try the most obvious thing.

The gdb backtrace:
Core was generated by `bin/circle -q 4000'.
Program terminated with signal 11, Segmentation fault.
#0  0x804b95e in perform_act (orig=0x80a49db "objs", ch=0x8258940,
    vict_obj=0x82580b8, to=0x82ac8a8) at comm.c:1827
1827            CHECK_NULL(vict_obj, PERS((struct char_data *) vict_obj,
(gdb) back
#0  0x804b95e in perform_act (orig=0x80a49db "objs", ch=0x8258940,
    vict_obj=0x82580b8, to=0x82ac8a8) at comm.c:1827
#1  0x804c01a in act (str=0x80a49c7 " follow $N.", hide_invisible=1,
    ch=0x8258940, obj=0x0, vict_obj=0x82580b8, type=3) at comm.c:1948
#2  0x8081ce1 in stop_follower (ch=0x8258940) at utils.c:331
#3  0x8081d6a in add_follower (ch=0x8258940, leader=0x8258940) at
#4  0x806d288 in extract_char (ch=0x8258940) at handler.c:842
#5  0x806a9ca in die (ch=0x8258940) at fight.c:332
#6  0x806aa01 in perform_group_gain (ch=0x8258940, base=5038,
    at fight.c:346
#7  0x806b7f0 in hit (ch=0x82ac8a8, victim=0x8258940, type=5038) at
#8  0x806badd in perform_violence () at fight.c:898
#9  0x806bc1c in perform_violence () at fight.c:957
#10 0x804a26a in heartbeat (pulse=600) at comm.c:767
#11 0x804a1e1 in game_loop (mother_desc=3) at comm.c:741
#12 0x80496b9 in init_game (port=4000) at comm.c:288
#13 0x8049646 in main (argc=3, argv=0xbffffd7c) at comm.c:256

Brad Hartin

PS:  I long since wrote the code for wielding and the use of the
skill, and they worked just fine--until the mob died.  Sign

     | 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