summaryrefslogtreecommitdiff
path: root/src/monster3.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2011-02-20 09:32:05 +0100
committerBardur Arantsson <bardur@scientician.net>2011-02-20 09:32:05 +0100
commitc4f2e466bca7b30d2798237367ab0538456cf85a (patch)
tree866e273c386e15cadcb0ef0a107e2ecc86dab8fb /src/monster3.c
parent534032607ebc420df5c26d7af9c488ea4a318e81 (diff)
Killerbunnies: Add companions to character dump.
Diffstat (limited to 'src/monster3.c')
-rw-r--r--src/monster3.c35
1 files changed, 35 insertions, 0 deletions
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);
+ }
+ }
+}