void do_givedream (CHAR_DATA *ch, char *argument, int cmd) { CHAR_DATA *who; char buf [MAX_STRING_LENGTH] = {'\0'}; argument = one_argument (argument, buf); if ( !(who = load_pc (buf)) ) { send_to_char ("No such PC.\n\r", ch); return; } if ( who->pc->create_state != 2 ) { send_to_char ("PC is not in state 2.\n\r", ch); unload_pc (who); return; } make_quiet (ch); ch->delay_who = NULL; ch->delay_ch = who; ch->desc->str = &ch->delay_who; ch->desc->max_str = MAX_INPUT_LENGTH; ch->desc->proc = post_dream; }
void post_dream (DESCRIPTOR_DATA *d) { char *p = NULL; char *date = NULL; DREAM_DATA *dream; CHAR_DATA *ch; p = d->character->delay_who; ch = d->character->delay_ch; if ( !p || !*p ) { send_to_char ("Dream aborted.\n\r", d->character); unload_pc (d->character->delay_ch); return; } CREATE (dream, DREAM_DATA, 1); dream->dream = d->character->delay_who; dream->next = ch->pc->dreams; d->character->delay_who = NULL; ch->pc->dreams = dream; send_to_char ("Dream added.\n\r", d->character); date = timestr(date); add_message (GET_NAME (ch), /* PC board */ 3, /* message # */ GET_NAME (d->character), /* Imm name */ date, "Entry via GIVEDREAM command.", "", dream->dream, MF_DREAM); unload_pc (ch); mem_free (date); }
void close_socket (DESCRIPTOR_DATA * d) { DESCRIPTOR_DATA *tmp; char buf[100]; if (d->connected == CON_SOFT_REBOOT) /* Soft reboot sockets. */ return; if (d->character) /* I don't know about this one. . . */ d->character->desc = 0; close (d->hSocketFD); flush_queues (d); if (d->hSocketFD == maxdesc) --maxdesc; if (d->character && d->connected != CON_PLYNG) { unload_pc (d->character); d->character = NULL; } else if (d->character && d->connected == CON_PLYNG) { if (d->character->pc) d->character->pc->last_disconnect = time (0); save_char (d->character, true); /* KLUDGE: If the player is disconnecting is staff, he will get a message about himself disconnecting. However, he will be gone before that message gets to him, and the message will sit around in memory. By saying he isn't connected, the message will not be sent. (connected = -1) */ if (d->original) { d->character = d->original; d->original = NULL; } sprintf (s_buf, "%s has lost link.\n", d->character->tname); d->connected = CON_LINKDEAD; send_to_gods (s_buf); d->connected = CON_PLYNG; if (d->snoop.snooping && d->snoop.snooping->desc) { d->snoop.snooping->desc->snoop.snoop_by = 0; d->snoop.snooping = 0; } if (d->snoop.snoop_by && d->snoop.snoop_by->desc) { d->snoop.snoop_by->desc->snoop.snooping = 0; d->snoop.snoop_by = 0; } if (d->character->pc) d->character->pc->owner = 0; if (IS_MORTAL (d->character) && !IS_SET (d->character->flags, FLAG_GUEST)) { act ("$n has lost link.", true, d->character, 0, 0, TO_ROOM); sprintf (buf, "Closing link to: %s.", GET_NAME (d->character)); system_log (buf, false); d->character->desc = 0; } else if (IS_SET (d->character->flags, FLAG_GUEST)) do_quit (d->character, "", 0); } if (d->acct) delete d->acct; if (next_to_process == d) next_to_process = next_to_process->next; if (d == descriptor_list) { /* this is the head of the list */ descriptor_list = descriptor_list->next; } else { for (tmp = descriptor_list; tmp->next; tmp = tmp->next) if (tmp->next == d) { tmp->next = tmp->next->next; break; } } d->next = NULL; free_descriptor (d); socket_closed = true; }