diff options
author | Stefan O'Rear <stefanor@cox.net> | 2009-11-12 17:06:36 -0800 |
---|---|---|
committer | Stefan O'Rear <stefanor@cox.net> | 2009-11-12 17:06:36 -0800 |
commit | 36bf008a572e07ee3f26751d15adacc7e26a3390 (patch) | |
tree | afbe54b3c7686e5d533f1fb1e2e9aa6c570e337d /crawl-ref/source/hiscores.cc | |
parent | 1105fd0a56b60e6c2395dfd632f5aa561d9f36ca (diff) | |
download | crawl-ref-36bf008a572e07ee3f26751d15adacc7e26a3390.tar.gz crawl-ref-36bf008a572e07ee3f26751d15adacc7e26a3390.zip |
Add ikiller and kpath to the logfile
Diffstat (limited to 'crawl-ref/source/hiscores.cc')
-rw-r--r-- | crawl-ref/source/hiscores.cc | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 73b19f57a8..57fe11fdda 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -499,6 +499,8 @@ void scorefile_entry::init_from(const scorefile_entry &se) mon_num = se.mon_num; death_source_name = se.death_source_name; auxkilldata = se.auxkilldata; + indirectkiller = se.indirectkiller; + killerpath = se.killerpath; dlvl = se.dlvl; level_type = se.level_type; branch = se.branch; @@ -594,6 +596,8 @@ void scorefile_entry::init_with_fields() death_type = str_to_kill_method(fields->str_field("ktyp")); death_source_name = fields->str_field("killer"); auxkilldata = fields->str_field("kaux"); + indirectkiller = fields->str_field("ikiller"); + killerpath = fields->str_field("kpath"); branch = str_to_branch(fields->str_field("br"), BRANCH_MAIN_DUNGEON); dlvl = fields->int_field("lvl"); @@ -713,6 +717,8 @@ void scorefile_entry::set_score_fields() const fields->add_field("dam", "%d", damage); fields->add_field("kaux", "%s", auxkilldata.c_str()); + fields->add_field("ikiller", "%s", indirectkiller.c_str()); + fields->add_field("kpath", "%s", killerpath.c_str()); if (piety > 0) fields->add_field("piety", "%d", piety); @@ -837,11 +843,33 @@ void scorefile_entry::init_death_cause(int dam, int dsrc, death_source_name += " (shapeshifter)"; else if (monster->has_ench(ENCH_GLOWING_SHAPESHIFTER)) death_source_name += " (glowing shapeshifter)"; + + if (monster->props.exists("blame")) + { + const CrawlVector& blame = monster->props["blame"].get_vector(); + + indirectkiller = blame[blame.size() - 1].get_string(); + killerpath = ""; + + for (CrawlVector::const_iterator it = blame.begin(); + it != blame.end(); ++it) + { + killerpath = killerpath + ":" + xlog_escape(it->get_string()); + } + + killerpath.erase(killerpath.begin()); + } + else + { + indirectkiller = death_source_name; + killerpath = ""; + } } else { mon_num = 0; death_source_name.clear(); + indirectkiller = killerpath = ""; } if (death_type == KILLED_BY_WEAKNESS @@ -871,6 +899,8 @@ void scorefile_entry::reset() mon_num = 0; death_source_name.clear(); auxkilldata.clear(); + indirectkiller.clear(); + killerpath.clear(); dlvl = 0; level_type = LEVEL_DUNGEON; branch = BRANCH_MAIN_DUNGEON; @@ -2037,13 +2067,13 @@ void xlog_fields::init(const std::string &line) } // xlogfile escape: s/:/::/g -std::string xlog_fields::xlog_escape(const std::string &s) const +std::string xlog_escape(const std::string &s) { return replace_all(s, ":", "::"); } // xlogfile unescape: s/::/:/g -std::string xlog_fields::xlog_unescape(const std::string &s) const +std::string xlog_unescape(const std::string &s) { return replace_all(s, "::", ":"); } |