src/dg_handler.c
void extract_script(void *thing, int type)
{
  struct script_data *sc = NULL;
  struct trig_data *trig, *next_trig;
  char_data *mob;
  obj_data *obj;
  room_data *room;

  switch (type) {
    case MOB_TRIGGER:
      mob = (struct char_data *)thing;
      sc = SCRIPT(mob);
      SCRIPT(mob) = NULL;
      break;
    case OBJ_TRIGGER:
      obj = (struct obj_data *)thing;
      sc = SCRIPT(obj);
      SCRIPT(obj) = NULL;
      break;
    case WLD_TRIGGER:
      room = (struct room_data *)thing;
      sc = SCRIPT(room);
      SCRIPT(room) = NULL;
      break;
  }

#if 0 /* debugging */
  {
    struct char_data *i = character_list;
    struct obj_data *j = object_list;
    room_rnum k;
    if (sc) {
      for ( ; i ; i = i->next)
        assert(sc != SCRIPT(i));
      
      for ( ; j ; j = j->next)
        assert(sc != SCRIPT(j));
    
      for (k = 0; k < top_of_world; k++)
        assert(sc != SCRIPT(&world[k]));
    }
  }
#endif
  for (trig = TRIGGERS(sc); trig; trig = next_trig) {
    next_trig = trig->next;
    extract_trigger(trig);
  }
  TRIGGERS(sc) = NULL;
  
  free(sc);
}
/* remove all triggers from a mob/obj/room */
remove all triggers from a mob/obj/room
remove all triggers from a mob / obj / room
void extract_script(void *thing, int type)
{
  struct script_data *sc = NULL;
  struct trig_data *trig, *next_trig;
  char_data *mob;
  obj_data *obj;
  room_data *room;
  switch (type) {
    case MOB_TRIGGER:
      mob = (struct char_data *)thing;
      sc = SCRIPT(mob);
      SCRIPT(mob) = NULL;
      break;
    case OBJ_TRIGGER:
      obj = (struct obj_data *)thing;
      sc = SCRIPT(obj);
      SCRIPT(obj) = NULL;
      break;
    case WLD_TRIGGER:
      room = (struct room_data *)thing;
      sc = SCRIPT(room);
      SCRIPT(room) = NULL;
      break;
  }
#if 0 
  {
    struct char_data *i = character_list;
    struct obj_data *j = object_list;
    room_rnum k;
    if (sc) {
      for ( ; i ; i = i->next)
        assert(sc != SCRIPT(i));
      for ( ; j ; j = j->next)
        assert(sc != SCRIPT(j));
      for (k = 0; k < top_of_world; k++)
        assert(sc != SCRIPT(&world[k]));
    }
  }
#endif
  for (trig = TRIGGERS(sc); trig; trig = next_trig) {
    next_trig = trig->next;
    extract_trigger(trig);
  }
  TRIGGERS(sc) = NULL;
  free(sc);
}
void extract_script ( void * thing , int type ) { struct script_data * sc = NULL ; struct trig_data * trig , * next_trig ; char_data * mob ; obj_data * obj ; room_data * room ; switch ( type ) { case MOB_TRIGGER : mob = ( struct char_data * ) thing ; sc = SCRIPT ( mob ) ; SCRIPT ( mob ) = NULL ; break ; case OBJ_TRIGGER : obj = ( struct obj_data * ) thing ; sc = SCRIPT ( obj ) ; SCRIPT ( obj ) = NULL ; break ; case WLD_TRIGGER : room = ( struct room_data * ) thing ; sc = SCRIPT ( room ) ; SCRIPT ( room ) = NULL ; break ; } #if 0 { struct char_data * i = character_list ; struct obj_data * j = object_list ; room_rnum k ; if ( sc ) { for ( ; i ; i = i -> next ) assert ( sc != SCRIPT ( i ) ) ; for ( ; j ; j = j -> next ) assert ( sc != SCRIPT ( j ) ) ; for ( k = 0 ; k < top_of_world ; k ++ ) assert ( sc != SCRIPT ( & world [ k ] ) ) ; } } #endif for ( trig = TRIGGERS ( sc ) ; trig ; trig = next_trig ) { next_trig = trig -> next ; extract_trigger ( trig ) ; } TRIGGERS ( sc ) = NULL ; free ( sc ) ; }
remove all triggers from a mob/obj/room
remove all triggers from a mob / obj / room
/* debugging */