Beispiel #1
0
/*
 * Handle abrupt death of the visual system
 *
 * This routine is called only in very rare situations, and only
 * by certain visual systems, when they experience fatal errors.
 *
 * XXX XXX Hack -- clear the death flag when creating a HANGUP
 * save file so that player can see tombstone when restart.
 */
void exit_game_panic(void)
{
	/* If nothing important has happened, just quit */
	if (!character_generated || character_saved) quit("panic");

	/* Mega-Hack -- see "msg_print()" */
	msg_flag = FALSE;

	/* Clear the top line */
	prt("", 0, 0);

	/* Hack -- turn off some things */
	disturb(1, 0);

	/* Hack -- Delay death XXX XXX XXX */
	if (p_ptr->chp < 0) p_ptr->is_dead = FALSE;

	/* Hardcode panic save */
	p_ptr->panic_save = 1;

	/* Forbid suspend */
	signals_ignore_tstp();

	/* Indicate panic save */
	my_strcpy(p_ptr->died_from, "(panic save)", sizeof(p_ptr->died_from));

	/* Panic save, or get worried */
	if (!old_save()) quit("panic save failed!");


	/* Successful panic save */
	quit("panic save succeeded!");
}
Beispiel #2
0
/**
 * Handle character death
 */
void death_screen(void)
{
    const region area = { 51, 2, 0, N_ELEMENTS(death_actions) };

    /* Dump bones file */
    make_bones();

    /* Handle retirement */
    if (p_ptr->total_winner)
	kingly();

    /* Save dead player */
    if (!old_save())
    {
	msg_print("death save failed!");
	message_flush();
    }

    /* Get time of death */
#ifdef _WIN32_WCE
    {
	unsigned long fake_time(unsigned long *fake_time_t);
	fake_time(&death_time);
    }
#else
    (void) time(&death_time);
#endif

    /* You are dead */
    print_tomb();

    /* Hack - Know everything upon death */
    death_knowledge();

    /* Enter player in high score list */
    enter_score(&death_time);

    /* Flush all input keys */
    flush();

    /* Flush messages */
    msg_print(NULL);

    if (!death_menu)
    {
	death_menu = menu_new_action(death_actions,
				     N_ELEMENTS(death_actions));

	death_menu->flags = MN_CASELESS_TAGS;
    }

    menu_layout(death_menu, &area);

    do
    {
	menu_select(death_menu, 0);
    } while (!get_check("Do you want to quit? "));
}
Beispiel #3
0
/*
 * Handle signal -- abort, kill, etc
 */
static void handle_signal_abort(int sig)
{
	/* Disable handler */
	(void)(*signal_aux)(sig, SIG_IGN);


	/* Nothing to save, just quit */
	if (!character_generated || character_saved) quit(NULL);


	/* Clear the bottom line */
	Term_erase(0, 23, 255);

	/* Give a warning */
	Term_putstr(0, 23, -1, TERM_RED,
	            "A gruesome software bug LEAPS out at you!");

	/* Message */
	Term_putstr(45, 23, -1, TERM_RED, "Panic save...");

	/* Flush output */
	Term_fresh();

	/* Panic Save
	p_ptr->panic_save = 1; */

	/* Panic save */
	my_strcpy(p_ptr->died_from, "(panic save)", sizeof(p_ptr->died_from));

	/* Forbid suspend */
	signals_ignore_tstp();

	/* Attempt to save */
	if (old_save())
	{
		Term_putstr(45, 23, -1, TERM_RED, "Panic save succeeded!");
	}

	/* Save failed */
	else
	{
		Term_putstr(45, 23, -1, TERM_RED, "Panic save failed!");
	}

	/* Flush output */
	Term_fresh();

	/* Quit */
	quit("software bug");
}
Beispiel #4
0
/*
 * Save the game
 */
void save_game(void)
{
	/* Disturb the player */
	disturb(1, 0);

	/* Clear messages */
	message_flush();

	/* Handle stuff */
	handle_stuff();

	/* Message */
	prt("Saving game...", 0, 0);

	/* Refresh */
	Term_fresh();

	/* The player is not dead */
	my_strcpy(p_ptr->died_from, "(saved)", sizeof(p_ptr->died_from));

	/* Forbid suspend */
	signals_ignore_tstp();

	/* Save the player */
	if (old_save())
	{
		prt("Saving game... done.", 0, 0);
	}

	/* Save failed (oops) */
	else
	{
		prt("Saving game... failed!", 0, 0);
	}

	/* Allow suspend again */
	signals_handle_tstp();

	/* Refresh */
	Term_fresh();

	/* Note that the player is not dead */
	my_strcpy(p_ptr->died_from, "(alive and well)", sizeof(p_ptr->died_from));
}