Making DG scripts work with Grenades

From: Dan Argent (mbax7dja@FS1.CS.MAN.AC.UK)
Date: 06/03/98


Okay,
it seems i is pointing to NULL, or something,
but the question is why? as it seem to go through the object list in
exactly the same way as all the others.
Is it the DG scripts going through the list and messing it up?

anyway:

Program received signal SIGSEGV, Segmentation fault.
0x806cd73 in tick_grenade () at fight.c:1191
1191        if (IS_SET(GET_OBJ_EXTRA(i), ITEM_LIVE_GRENADE)) {
(gdb) print i
$1 = (obj_data *) 0x80
(gdb)
1186         one of the extra flag bits. After the pin is pulled
the grenade
 1187         starts counting down. once it reaches zero,
it explodes. */
1188
1189      for (i = object_list; i; i = i->next) {
1190
1191        if (IS_SET(GET_OBJ_EXTRA(i), ITEM_LIVE_GRENADE)) {
1192          /* update ticks */
1193          if (i->obj_flags.value[0] >0)
1194            i->obj_flags.value[0] -=1;
1195          else {

The backtrace :

#0  0x806cd73 in tick_grenade () at fight.c:1191
#1  0x804a045 in heartbeat (pulse=220) at comm.c:723
#2  0x8049f8d in game_loop (mother_desc=7) at comm.c:686
#3  0x8049646 in init_game (port=4000) at comm.c:279
#4  0x80495da in main (argc=1, argv=0xbffffd88) at comm.c:249
#5  0x804931b in _start ()

Most of the Front of tick_grenade:

void tick_grenade(void)
{
  struct obj_data *i, *tobj;
  struct char_data *tch, *next_tch;
  int s, t, dam, door;
  /* grenades are activated by pulling the pin - ie, setting the
     one of the extra flag bits. After the pin is pulled the grenade
     starts counting down. once it reaches zero, it explodes. */

  for (i = object_list; i; i = i->next) {

    if (IS_SET(GET_OBJ_EXTRA(i), ITEM_LIVE_GRENADE)) {
      /* update ticks */
      if (i->obj_flags.value[0] >0)
        i->obj_flags.value[0] -=1;
      else {
        t = 0;

        /* blow it up */


and FINALLY

Comm.c

void heartbeat(int pulse)
{
  static int mins_since_crashsave = 0;
  void process_events(void);

  dg_global_pulse++;

  process_events();


  if (!(pulse % PULSE_ZONE))
    zone_update();

  if (!(pulse % (15 * PASSES_PER_SEC)))         /* 15 seconds */
    check_idle_passwords();

  if (!(pulse % PULSE_MOBILE))
    mobile_activity();

if (!(pulse % PULSE_DG_SCRIPT))
    script_trigger_check();

  if (!(pulse % PULSE_VIOLENCE)) {
 tick_grenade();
     perform_violence();

    }

So it script_trigger_check mucking it up?

Any ideas?
Dan.


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