コード例 #1
0
ファイル: birth.c プロジェクト: halfsickofshadows/Sil
/*
 * Create a new character.
 *
 * Note that we may be called with "junk" leftover in the various
 * fields, so we must be sure to clear them first.
 */
void player_birth()
{
	int i;

	char raw_date[25];
	char clean_date[25];
	char month[4];
	time_t ct = time((time_t*)0);
	
	/* Create a new character */
	while (1)
	{
		/* Wipe the player */
		player_wipe();

		/* Roll up a new character */
		if (player_birth_aux()) break;
	}

	for (i = 0; i < NOTES_LENGTH; i++)
	{
		notes_buffer[i] = '\0';
	}

	/* Get date */
	(void)strftime(raw_date, sizeof(raw_date), "@%Y%m%d", localtime(&ct));
	
	sprintf(month,"%.2s", raw_date + 5);
	atomonth(atoi(month), month);
	
	if (*(raw_date + 7) == '0')		sprintf(clean_date, "%.1s %.3s %.4s", raw_date + 8, month, raw_date + 1);
	else							sprintf(clean_date, "%.2s %.3s %.4s", raw_date + 7, month, raw_date + 1);
	
	/* Add in "character start" information */
	my_strcat(notes_buffer, format("%s of the %s\n", op_ptr->full_name, p_name + rp_ptr->name), sizeof(notes_buffer));
	my_strcat(notes_buffer, format("Entered Angband on %s\n", clean_date), sizeof(notes_buffer));
	my_strcat(notes_buffer, "\n    Turn     Depth    Note\n\n", sizeof(notes_buffer));
	
	/* Note player birth in the message recall */
	message_add(" ", MSG_GENERIC);
	message_add("  ", MSG_GENERIC);
	message_add("====================", MSG_GENERIC);
	message_add("  ", MSG_GENERIC);
	message_add(" ", MSG_GENERIC);


	/* Hack -- outfit the player */
	player_outfit();

}
コード例 #2
0
ファイル: birth.c プロジェクト: elliptic/elliposchengband
void player_birth(void)
{
    birth_hack = TRUE;
    playtime = 0;

    wipe_m_list();
    player_wipe();

    /* Create a new character */
    if (py_birth() != UI_OK)
        quit(NULL);

    /* Here's a bunch of crap that py_birth() shouldn't need to know */
    init_turn();

    /* Generate the random seeds for the wilderness */
    seed_wilderness();

    birth_hack = FALSE;
}