Пример #1
0
/*
 * Helper function for monster-death.
 * Process the death of a quest monster.
 */
static void process_quest_monster_death(int i, int m_idx, bool *writenote)
{
	quest_type *q_ptr = &q_info[i];
	monster_type *m_ptr = &mon_list[m_idx];

	/* Not the right monster race for certain quests */
	if (quest_single_r_idx(q_ptr) || quest_fixed(q_ptr))
	{
		if (q_ptr->mon_idx != m_ptr->r_idx) return;
	}

	/* Not a quest that counts monster deaths */
	else if (quest_multiple_r_idx(q_ptr))
	{
		if (!(m_ptr->mflag & (MFLAG_QUEST))) return;
	}

	else if (quest_timed(q_ptr))
	{
		if (m_ptr->mflag & (MFLAG_QUEST))
		{
			q_ptr->q_num_killed++;
			p_ptr->redraw |= (PR_QUEST_ST);
			p_ptr->notice |= PN_QUEST_REMAIN;
		}
		return;
	}

	else return;

	/* Mark kills */
	q_ptr->q_num_killed++;

	/* Completed quest? */
	if (q_ptr->q_num_killed >= q_ptr->q_max_num)
	{
		/* Mark complete */
		quest_finished(q_ptr);

		/*
		 * Make a note of the completed quest, but not for fixed quests.
		 * That is a special note written later.
		 */
		if (!quest_fixed(q_ptr))
		{
			write_quest_note(TRUE);
			*writenote = FALSE;
		}
	}

	/*not done yet*/
	if (!(q_ptr->q_flags & (QFLAG_COMPLETED))) p_ptr->notice |= PN_QUEST_REMAIN;

	/* Update the quest status */
	p_ptr->redraw |= (PR_QUEST_ST);
}
Пример #2
0
/**
 * @brief Connects this console to a quest runner.
 * @param quest_runner The quest runner.
 */
void Console::set_quest_runner(QuestRunner& quest_runner) {

    this->quest_runner = &quest_runner;

    connect(ui.command_field, SIGNAL(returnPressed()),
            this, SLOT(command_field_activated()));

    connect(&quest_runner, SIGNAL(running()),
            this, SLOT(quest_running()));
    connect(&quest_runner, SIGNAL(finished()),
            this, SLOT(quest_finished()));
    connect(&quest_runner, SIGNAL(output_produced(QStringList)),
            this, SLOT(quest_output_produced(QStringList)));

}