summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/show.cc
diff options
context:
space:
mode:
authorRobert Vollmert <rvollmert@gmx.net>2009-11-18 22:10:48 +0100
committerRobert Vollmert <rvollmert@gmx.net>2009-11-20 12:55:07 +0100
commit9e638765909b661706f206c6422843b0c75d12a8 (patch)
tree70ff53fcecfcb0b7a0c4abea2ff035d3d4fe5fd2 /crawl-ref/source/show.cc
parentcd397dc4d76ee1ca808b7a19780b7f0a573331f1 (diff)
downloadcrawl-ref-9e638765909b661706f206c6422843b0c75d12a8.tar.gz
crawl-ref-9e638765909b661706f206c6422843b0c75d12a8.zip
Remove union in show_type.
show_type can now separately store feature type, item type and monster class. env.show and env.map_knowledge are guaranteed to have filled object.feat, so player terrain knowledge is available now. This is a bit of a hack.
Diffstat (limited to 'crawl-ref/source/show.cc')
-rw-r--r--crawl-ref/source/show.cc40
1 files changed, 33 insertions, 7 deletions
diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc
index d342225d9b..ec18a5aae7 100644
--- a/crawl-ref/source/show.cc
+++ b/crawl-ref/source/show.cc
@@ -23,25 +23,51 @@
#include "viewmap.h"
show_type::show_type()
- : cls(SH_NOTHING), colour(0)
+ : cls(SH_NOTHING),
+ feat(DNGN_UNSEEN),
+ item(SHOW_ITEM_NONE),
+ mons(MONS_NO_MONSTER),
+ colour(0)
{
- // To quiet Valgrind warnings.
- feat = (dungeon_feature_type) -1;
}
show_type::show_type(monster_type montype)
- : cls(SH_MONSTER), mons(montype), colour(0) {}
+ : cls(SH_MONSTER),
+ feat(DNGN_UNSEEN),
+ item(SHOW_ITEM_NONE),
+ mons(montype),
+ colour(0)
+{
+}
show_type::show_type(dungeon_feature_type f)
- : cls(SH_FEATURE), feat(f), colour(0) {}
+ : cls(SH_FEATURE),
+ feat(f),
+ item(SHOW_ITEM_NONE),
+ mons(MONS_NO_MONSTER),
+ colour(0)
+{
+}
static show_item_type _item_to_show_code(const item_def &item);
show_type::show_type(const item_def &it)
- : cls(SH_ITEM), item(_item_to_show_code(it)), colour(0) {}
+ : cls(SH_ITEM),
+ feat(DNGN_UNSEEN),
+ item(_item_to_show_code(it)),
+ mons(MONS_NO_MONSTER),
+ colour(0)
+{
+}
show_type::show_type(show_item_type t)
- : cls(SH_ITEM), item(t), colour(0) {}
+ : cls(SH_ITEM),
+ feat(DNGN_UNSEEN),
+ item(t),
+ mons(MONS_NO_MONSTER),
+ colour(0)
+{
+}
bool show_type::operator < (const show_type &other) const
{