--- src/externs.h.orig 2007-10-07 19:35:30.000000000 -0400 +++ src/externs.h 2007-12-08 17:28:45.000000000 -0500 @@ -1099,6 +1099,7 @@ extern void corrupt_corrupted(void); /* monster3.c */ +extern void dump_companions(FILE *outfile); extern void do_cmd_companion(void); extern bool do_control_reconnect(void); extern bool do_control_drop(void); --- src/files.c.orig 2007-10-11 20:48:33.000000000 -0400 +++ src/files.c 2007-12-08 17:28:45.000000000 -0500 @@ -3403,6 +3403,9 @@ dump_skills(fff); dump_abilities(fff); + /* Dump companions. */ + dump_companions(fff); + if (p_ptr->companion_killed) { if (p_ptr->companion_killed == 1) --- src/monster3.c.orig 2006-10-21 19:04:26.000000000 -0400 +++ src/monster3.c 2007-12-08 17:26:59.000000000 -0500 @@ -677,3 +677,38 @@ 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); + } + } +}