From c4f2e466bca7b30d2798237367ab0538456cf85a Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Sun, 20 Feb 2011 09:32:05 +0100 Subject: Killerbunnies: Add companions to character dump. --- src/monster3.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'src/monster3.c') diff --git a/src/monster3.c b/src/monster3.c index 786c6041..f381c94c 100644 --- a/src/monster3.c +++ b/src/monster3.c @@ -669,3 +669,38 @@ void do_cmd_companion() else msg_print("You must target a pet."); } + +/* + * List companions to the character sheet. + */ +void dump_companions(FILE *outfile) +{ + int i; + int done_hdr = 0; + + /* Process the monsters (backwards) */ + for (i = m_max - 1; i >= 1; i--) + { + /* Access the monster */ + monster_type *m_ptr = &m_list[i]; + + /* Ignore "dead" monsters */ + if (!m_ptr->r_idx) continue; + + if (m_ptr->status == MSTATUS_COMPANION) + { + char pet_name[80]; + + /* Output the header if we haven't yet. */ + if (!done_hdr) + { + done_hdr = 1; + fprintf(outfile, "\n\n [Current companions]\n\n"); + } + + /* List the monster. */ + monster_desc(pet_name, m_ptr, 0x88); + fprintf(outfile, "%s (level %d)\n", pet_name, m_ptr->level); + } + } +} -- cgit v1.2.3