diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-16 11:35:18 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-16 12:19:59 +0100 |
commit | 94efa11e1613a3328378a2e1f9831f144490d434 (patch) | |
tree | 251c872158ffa4be53f8c0a0b52007b033d7820b /crawl-ref/source/mon-util.cc | |
parent | 975e3a88520ca52bd5f8fcfb8ecda505d823a561 (diff) | |
download | crawl-ref-94efa11e1613a3328378a2e1f9831f144490d434.tar.gz crawl-ref-94efa11e1613a3328378a2e1f9831f144490d434.zip |
Fix information leakage in detect creatures.
Also fix tiles giving more information than console version.
There's now mons_detected_base, which assigns a base monster
type to every monster type based on the default displayed
glyph. It just takes the first entry for a given glyph
based on the mon-data.h order, so this may need tweaking
in some cases.
Diffstat (limited to 'crawl-ref/source/mon-util.cc')
-rw-r--r-- | crawl-ref/source/mon-util.cc | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 3d07524355..dc953f4305 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -215,6 +215,8 @@ void init_monsters() void init_monster_symbols() { + std::map<unsigned, monster_type> base_mons; + std::map<unsigned, monster_type>::iterator it; for (int i = 0; i < NUM_MONSTERS; ++i) { mon_display &md = monster_symbols[i]; @@ -223,6 +225,10 @@ void init_monster_symbols() { md.glyph = me->showchar; md.colour = me->colour; + it = base_mons.find(md.glyph); + if (it == base_mons.end() || it->first == MONS_PROGRAM_BUG) + base_mons[md.glyph] = static_cast<monster_type>(i); + md.detected = base_mons[md.glyph]; } } @@ -697,6 +703,11 @@ monster_type mons_genus(int mc) return (smc->genus); } +monster_type mons_detected_base(monster_type mc) +{ + return (monster_symbols[mc].detected); +} + monster_type draco_subspecies(const monsters *mon) { ASSERT(mons_genus(mon->type) == MONS_DRACONIAN); |