Multihit for mobs by Christian Duvall

From: Crimson Wizard (cwizard@GIBLETS.COM)
Date: 08/11/97


First i noticed there's a hole in the instructions, ie... you need to add
the appropriate define's to olc.h, but another curious thing is in fight.c
when you add the routine to perform_violence() and compile, first it
grumbles about may not be initialising "ch" then this pretty little
coredump happens:

Mon Aug 11 15:33:44 :: New connection.  Waking up.
Segmentation fault (core dumped)

GDB 4.14 (i486-linux), Copyright 1995 Free Software Foundation, Inc...
Core was generated by `bin/circle 6666'.
Program terminated with signal 11, Segmentation fault.
#0  perform_violence () at fight.c:953
953       if (IS_NPC(ch)) {

Here's our friendly uninitialized "ch", I added the bit of code as
follows:

void perform_violence(void)
{
  struct char_data *ch;
  extern struct index_data *mob_index;
  int perc, val, apr;

  if (IS_NPC(ch)) {
    perc = number(1, 101);
    val = ch->mob_specials.attack1;
    if (val > perc) {
**snip**

I have run into this problem before when I did the chown command, and the
solution to the problem was initializing the struct.. the problem appears
to be the exact same here... with the solution directly under my nose..
but i'm not sure what it is.. I'll try things out but I wanted to send
this to the list.

(gdb) bt
#0  perform_violence () at fight.c:953
#1  0x8048e81 in heartbeat (pulse=20) at comm.c:697
#2  0x8048dbe in game_loop (mother_desc=3) at comm.c:665
#3  0x8048414 in init_game (port=6666) at comm.c:252
#4  0x804839e in main (argc=2, argv=0xbffff76c) at comm.c:222
#5  0x80480e4 in _start ()

(gdb) list
948     {
949       struct char_data *ch;
950       extern struct index_data *mob_index;
951       int perc, val, apr;
952
953       if (IS_NPC(ch)) {
954         perc = number(1, 101);
955         val = ch->mob_specials.attack1;
956         if (val > perc) {
957           apr++;

Thanks.

--
#!/bin/sh
whois yea.com|grep YEA2|awk '{print $1}'
whois aree.com|grep DOM|awk '{print $1}'
whois aree.com|grep DOM|awk '{print $1}'|cut -c1
whois tm920|grep TM920|awk '{print $4}'|cut -d@ -f1


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