From 94efa11e1613a3328378a2e1f9831f144490d434 Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Mon, 16 Nov 2009 11:35:18 +0100 Subject: 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. --- crawl-ref/source/mon-util.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'crawl-ref/source/mon-util.cc') 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 base_mons; + std::map::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(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); -- cgit v1.2.3-54-g00ecf