diff options
author | Adam Borowski <kilobyte@angband.pl> | 2011-05-17 03:14:07 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2011-05-17 03:14:56 +0200 |
commit | 628cc57bdb09142702d3866beb6953547f636bc9 (patch) | |
tree | 8c3ea2d623d373f9a4972b067dee15b0acc9f0b6 /crawl-ref/source/map_knowledge.h | |
parent | 7c11992ab8a856dc7aa2621bdf6d50bf715bbb46 (diff) | |
download | crawl-ref-628cc57bdb09142702d3866beb6953547f636bc9.tar.gz crawl-ref-628cc57bdb09142702d3866beb6953547f636bc9.zip |
Remember the trap type in map_knowledge.
This fixes information leaks when a trap runs out of ammo out of LOS.
Diffstat (limited to 'crawl-ref/source/map_knowledge.h')
-rw-r--r-- | crawl-ref/source/map_knowledge.h | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/crawl-ref/source/map_knowledge.h b/crawl-ref/source/map_knowledge.h index b367064ebe..24e6b95ed5 100644 --- a/crawl-ref/source/map_knowledge.h +++ b/crawl-ref/source/map_knowledge.h @@ -38,7 +38,8 @@ struct map_cell uint32_t flags; // Flags describing the mappedness of this square. map_cell() : flags(0), _feat(DNGN_UNSEEN), _feat_colour(0), - _item(0), _mons(0), _cloud(CLOUD_NONE), _cloud_colour(0) + _cloud(CLOUD_NONE), _cloud_colour(0), _item(0), _mons(0), + _trap(TRAP_UNASSIGNED) { } @@ -96,10 +97,12 @@ struct map_cell return _feat_colour; } - void set_feature(dungeon_feature_type nfeat, unsigned colour = 0) + void set_feature(dungeon_feature_type nfeat, unsigned colour = 0, + trap_type tr = TRAP_UNASSIGNED) { _feat = nfeat; _feat_colour = colour; + _trap = tr; } item_info* item() const @@ -224,13 +227,19 @@ struct map_cell return !!(flags & MAP_MAGIC_MAPPED_FLAG); } + trap_type trap() const + { + return _trap; + } + private: - dungeon_feature_type _feat; + dungeon_feature_type _feat:8; uint8_t _feat_colour; + cloud_type _cloud:8; + uint8_t _cloud_colour; item_info* _item; monster_info* _mons; - cloud_type _cloud; - uint8_t _cloud_colour; + trap_type _trap:8; }; void set_terrain_mapped(int x, int y); |