From abec3e39f39b3f598c90b645a45bb43097b8e5cb Mon Sep 17 00:00:00 2001 From: ennewalker Date: Sat, 10 Jan 2009 16:23:13 +0000 Subject: [2495836] Show names for friendly uniques during arena mode. Also, add a tile_tag_pref option. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8383 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/Kills.cc | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'crawl-ref/source/Kills.cc') diff --git a/crawl-ref/source/Kills.cc b/crawl-ref/source/Kills.cc index 6da4e56a28..b40e6b3a39 100644 --- a/crawl-ref/source/Kills.cc +++ b/crawl-ref/source/Kills.cc @@ -229,6 +229,20 @@ void KillMaster::add_kill_info(std::string &killtext, } } +long KillMaster::num_kills(const monsters *mon, kill_category cat) const +{ + return categorized_kills[cat].num_kills(mon); +} + +long KillMaster::num_kills(const monsters *mon) const +{ + long total = 0; + for (int cat = 0; cat < KC_NCATEGORIES; cat++) + total += categorized_kills[cat].num_kills(mon); + + return total; +} + /////////////////////////////////////////////////////////////////////////// bool Kills::empty() const @@ -344,6 +358,22 @@ void Kills::record_ghost_kill(const struct monsters *mon) ghosts.push_back(ghostk); } +int Kills::num_kills(const monsters *mon) const +{ + kill_monster_desc desc(mon); + kill_map::const_iterator iter = kills.find(desc); + int total = (iter == kills.end() ? 0 : iter->second.kills); + + if (desc.modifier == kill_monster_desc::M_SHAPESHIFTER) + { + desc.modifier = kill_monster_desc::M_NORMAL; + iter = kills.find(desc); + total += (iter == kills.end() ? 0 : iter->second.kills); + } + + return total; +} + kill_def::kill_def(const struct monsters *mon) : kills(0), exp(0) { exp = exper_value(mon); -- cgit v1.2.3-54-g00ecf