Пример #1
0
struct mud_event_data * char_has_mud_event(struct char_data * ch, event_id iId)
{
  struct event * pEvent;
  struct mud_event_data * pMudEvent;
  bool found = FALSE;

  if (ch->events->iSize == 0)
    return NULL;

  simple_list(NULL);

  while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) {
    if (!pEvent->isMudEvent)
      continue;
     pMudEvent = (struct mud_event_data * ) pEvent->event_obj;
    if (pMudEvent->iId == iId) {
     found = TRUE;
     break;
    }
  }
  
  simple_list(NULL);
  
  if (found)
    return (pMudEvent);
  
  return NULL;
} 
Пример #2
0
/* change_event_duration contributed by Ripley */
void change_event_duration(struct char_data * ch, event_id iId, long time)
{
  struct event * pEvent;
  struct mud_event_data * pMudEvent;
  bool found = FALSE;

  if (ch->events == NULL)
    return;

  if (ch->events->iSize == 0)
    return;

  clear_simple_list();  

  while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) {
    if (!pEvent->isMudEvent)
      continue;

    pMudEvent = (struct mud_event_data * ) pEvent->event_obj;

    if (pMudEvent->iId == iId) {
      found = TRUE;
      break;
    }
  }

  if (found) {        
    /* So we found the offending event, now build a new one, with the new time */
    attach_mud_event(new_mud_event(iId, pMudEvent->pStruct, pMudEvent->sVariables), time);
    event_cancel(pEvent);
  }    

}
Пример #3
0
void clear_char_event_list(struct char_data * ch)
{
  struct event * pEvent;
    
  if (ch->events == NULL)
    return;
    
  if (ch->events->iSize == 0)
    return;
    
  simple_list(NULL);

  while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) {
    event_cancel(pEvent);
  }
  
  simple_list(NULL);  
}
Пример #4
0
/* Extract an object from the world */
void extract_obj(struct obj_data *obj)
{
  struct char_data *ch, *next = NULL;
  struct obj_data *temp;

  if (obj->worn_by != NULL)
    if (unequip_char(obj->worn_by, obj->worn_on) != obj)
      log("SYSERR: Inconsistent worn_by and worn_on pointers!!");
  if (IN_ROOM(obj) != NOWHERE)
    obj_from_room(obj);
  else if (obj->carried_by)
    obj_from_char(obj);
  else if (obj->in_obj)
    obj_from_obj(obj);

  if (OBJ_SAT_IN_BY(obj)){
    for (ch = OBJ_SAT_IN_BY(obj); OBJ_SAT_IN_BY(obj); ch = next){
      if (!NEXT_SITTING(ch))
        OBJ_SAT_IN_BY(obj) = NULL;
      else
        OBJ_SAT_IN_BY(obj) = (next = NEXT_SITTING(ch));
      SITTING(ch) = NULL;
      NEXT_SITTING(ch) = NULL;
    }
  }

  /* Get rid of the contents of the object, as well. */
  while (obj->contains)
    extract_obj(obj->contains);

  REMOVE_FROM_LIST(obj, object_list, next);

  if (GET_OBJ_RNUM(obj) != NOTHING)
    (obj_index[GET_OBJ_RNUM(obj)].number)--;

  if (SCRIPT(obj))
    extract_script(obj, OBJ_TRIGGER);

  if (obj->events != NULL) {
	  if (obj->events->iSize > 0) {
		struct event * pEvent;

		while ((pEvent = simple_list(obj->events)) != NULL)
		  event_cancel(pEvent);
	  }
	  free_list(obj->events);
    obj->events = NULL;
  }

  if (GET_OBJ_RNUM(obj) == NOTHING || obj->proto_script != obj_proto[GET_OBJ_RNUM(obj)].proto_script)
    free_proto_script(obj, OBJ_TRIGGER);

  free_obj(obj);
}