diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-11-24 23:00:10 +0100 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-11-24 23:02:25 +0100 |
commit | 7e011d2d22e2e83430468e7e110516f8f60df8ce (patch) | |
tree | c101421c691875e95354efca59fe16940218c15f /crawl-ref/source/show.cc | |
parent | 9ad1ed0ee31d1fc809c62ca8cd5791342ee6a11d (diff) | |
download | crawl-ref-7e011d2d22e2e83430468e7e110516f8f60df8ce.tar.gz crawl-ref-7e011d2d22e2e83430468e7e110516f8f60df8ce.zip |
Properly deal with mimics in env.show.
Unknown mimics are now stored as items, not monsters.
Diffstat (limited to 'crawl-ref/source/show.cc')
-rw-r--r-- | crawl-ref/source/show.cc | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc index 280b83c4a2..5722ae80a7 100644 --- a/crawl-ref/source/show.cc +++ b/crawl-ref/source/show.cc @@ -10,6 +10,7 @@ #include "env.h" #include "fprop.h" #include "itemprop.h" +#include "mon-stuff.h" #include "mon-util.h" #include "monster.h" #include "options.h" @@ -216,7 +217,16 @@ static show_item_type _item_to_show_code(const item_def &item) void show_def::_update_item_at(const coord_def &gp, const coord_def &ep) { - const item_def &eitem = mitm[igrd(gp)]; + item_def eitem; + // Check for mimics. + const monsters* m = monster_at(gp); + if (m && mons_is_unknown_mimic(m)) + get_mimic_item(m, eitem); + else if (igrd(gp) != NON_ITEM) + eitem = mitm[igrd(gp)]; + else + return; + unsigned short &ecol = grid(ep).colour; glyph g = get_item_glyph(&eitem); @@ -289,6 +299,9 @@ void show_def::_update_monster(const monsters* mons) const coord_def pos = mons->pos(); const coord_def e = grid2show(pos); + if (mons_is_unknown_mimic(mons)) + return; + if (!mons->visible_to(&you)) { // ripple effect? @@ -354,8 +367,7 @@ void show_def::update_at(const coord_def &gp, const coord_def &ep) // The sequence is grid, items, clouds, monsters. _update_feat_at(gp, ep); - if (igrd(gp) != NON_ITEM) - _update_item_at(gp, ep); + _update_item_at(gp, ep); const int cloud = env.cgrid(gp); if (cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_NONE |