pload.c
Mor/Mor/src/pload.c · 2.3 KB
From the archive Mor.zip
Download the archive « Back to the archive contents
#if defined(macintosh)
#include <types.h>
#else
#include <sys/types.h>
#include <sys/time.h>
#endif
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <time.h>
#include "merc.h"
#include "interp.h"
void do_pload( CHAR_DATA *ch, char *argument )
{
DESCRIPTOR_DATA d;
bool isChar = FALSE;
char name[MAX_INPUT_LENGTH];
if (argument[0] == '\0')
{
send_to_char("Load who?\n\r", ch);
return;
}
argument[0] = UPPER(argument[0]);
argument = one_argument(argument, name);
/* Dont want to load a second copy of a player who's allready online! */
if ( get_char_world( ch, name ) != NULL )
{
send_to_char( "That person is allready connected!\n\r", ch );
return;
}
isChar = load_char_obj(&d, name); /* char pfile exists? */
if (!isChar)
{
send_to_char("Load Who? Are you sure? I cant seem to find them.\n\r", ch);
return;
}
d.character->desc = NULL;
d.character->next = char_list;
char_list = d.character;
d.connected = CON_PLAYING;
reset_char(d.character);
/* bring player to imm */
if ( d.character->in_room != NULL )
{
char_to_room( d.character, ch->in_room); /* put in room imm is in */
}
act( "$n has pulled $N from the pattern!",
ch, NULL, d.character, TO_ROOM );
if (d.character->pet != NULL)
{
char_to_room(d.character->pet,d.character->in_room);
act("$n has entered the game.",d.character->pet,NULL,NULL,TO_ROOM);
}
}
void do_punload( CHAR_DATA *ch, char *argument )
{
CHAR_DATA *victim;
char who[MAX_INPUT_LENGTH];
argument = one_argument(argument, who);
if ( ( victim = get_char_world( ch, who ) ) == NULL )
{
send_to_char( "They aren't here.\n\r", ch );
return;
}
/** Person is legitametly logged on... was not ploaded.
*/
if (victim->desc != NULL)
{
send_to_char("I dont think that would be a good idea...\n\r", ch);
return;
}
if (victim->was_in_room != NULL) /* return player and pet to orig room */
{
char_to_room(victim, victim->was_in_room);
if (victim->pet != NULL)
char_to_room(victim->pet, victim->was_in_room);
}
save_char_obj(victim);
//do_function(victim, &do_quit, "");
do_quit(victim,"");
act("$n has released $N back to the Pattern.",
ch, NULL, victim, TO_ROOM);
}