From 381bd5c28bb04dacd4fe2f7e8c51a0bdebbdcc8a Mon Sep 17 00:00:00 2001 From: Johanna Ploog Date: Tue, 15 Dec 2009 17:36:46 +0100 Subject: Print the overview screen and skills in the acquirement statistics output. --- crawl-ref/source/chardump.cc | 20 ++------------------ crawl-ref/source/skills2.cc | 21 +++++++++++++++++++++ crawl-ref/source/skills2.h | 1 + crawl-ref/source/wiz-item.cc | 17 +++++++++++++++++ 4 files changed, 41 insertions(+), 18 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc index 493fdcbf80..f71d4d3b15 100644 --- a/crawl-ref/source/chardump.cc +++ b/crawl-ref/source/chardump.cc @@ -911,26 +911,10 @@ static void _sdump_skills(dump_params &par) text += " Skills:"; text += "\n"; - for (unsigned char i = 0; i < 50; i++) - { - if (you.skills[i] > 0) - { - text += ( (you.skills[i] == 27) ? " * " : - (you.practise_skill[i]) ? " + " - : " - " ); - - text += "Level "; - itoa( you.skills[i], tmp_quant, 10 ); - text += tmp_quant; - text += " "; - text += skill_name(i); - text += "\n"; - } - } - + dump_skills(text); text += "\n"; text += "\n"; -} // end dump_skills() +} //--------------------------------------------------------------- // diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index c9c0c0046e..534220621d 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -2178,3 +2178,24 @@ bool is_invalid_skill(int skill) return (false); } + +void dump_skills(std::string &text) +{ + char tmp_quant[20]; + for (unsigned char i = 0; i < 50; i++) + { + if (you.skills[i] > 0) + { + text += ( (you.skills[i] == 27) ? " * " : + (you.practise_skill[i]) ? " + " + : " - " ); + + text += "Level "; + itoa( you.skills[i], tmp_quant, 10 ); + text += tmp_quant; + text += " "; + text += skill_name(i); + text += "\n"; + } + } +} diff --git a/crawl-ref/source/skills2.h b/crawl-ref/source/skills2.h index c7daf44be8..361acace5b 100644 --- a/crawl-ref/source/skills2.h +++ b/crawl-ref/source/skills2.h @@ -33,5 +33,6 @@ unsigned int skill_exp_needed(int lev); void show_skills(); void wield_warning(bool newWeapon = true); bool is_invalid_skill(int skill); +void dump_skills(std::string &text); #endif diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc index c7dd64f209..a3fdb7a2e4 100644 --- a/crawl-ref/source/wiz-item.cc +++ b/crawl-ref/source/wiz-item.cc @@ -28,7 +28,9 @@ #include "mon-stuff.h" #include "mon-util.h" #include "options.h" +#include "output.h" #include "religion.h" +#include "skills2.h" #include "spl-book.h" #include "stash.h" #include "stuff.h" @@ -928,6 +930,15 @@ static void _debug_acquirement_stats(FILE *ostat) return; } + // Print the overview screen to get information about species + // and equipped items. + fprintf(ostat, "%s\n\n", dump_overview_screen(false).c_str()); + + // Also print the skills, in case they matter. + std::string skills = "Skills:\n"; + dump_skills(skills); + fprintf(ostat, "%s\n\n", skills.c_str()); + fprintf(ostat, "acquirement called %d times, total quantity = %d\n\n", acq_calls, total_quant); @@ -1015,11 +1026,16 @@ static void _debug_acquirement_stats(FILE *ostat) } fprintf(ostat, "\n\n"); } + else if (type == OBJ_BOOKS) + { + // TODO: Count themed books' main spell school. + } item_def item; item.quantity = 1; item.base_type = type; + // First, get the maximum name length. int max_width = 0; for (int i = 0; i < 256; ++i) { @@ -1033,6 +1049,7 @@ static void _debug_acquirement_stats(FILE *ostat) max_width = std::max(max_width, (int) name.length()); } + // Now output the sub types. char format_str[80]; sprintf(format_str, "%%%ds: %%6.2f\n", max_width); -- cgit v1.2.3-54-g00ecf