summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/menu.cc
diff options
context:
space:
mode:
authorMatthew Cline <zelgadis@sourceforge.net>2009-11-20 23:18:02 -0800
committerMatthew Cline <zelgadis@sourceforge.net>2009-11-20 23:18:02 -0800
commit4da6707399c53c7989d0e9e7a421b153dce67458 (patch)
tree4a41bccd9e05fc20d60763560679499ca5f79fea /crawl-ref/source/menu.cc
parent37c7bf6bdee14c94b5340ce5adfd166d580705d1 (diff)
downloadcrawl-ref-4da6707399c53c7989d0e9e7a421b153dce67458.tar.gz
crawl-ref-4da6707399c53c7989d0e9e7a421b153dce67458.zip
Init FeatureMenuEntry from dungeon_feature_type
Add a second FeatureMenuEntry constructor, which accepts the dungeon_feature_type to use instead of the positon of the feature in question.
Diffstat (limited to 'crawl-ref/source/menu.cc')
-rw-r--r--crawl-ref/source/menu.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc
index 4db1788c9f..b641b01ace 100644
--- a/crawl-ref/source/menu.cc
+++ b/crawl-ref/source/menu.cc
@@ -721,10 +721,25 @@ FeatureMenuEntry::FeatureMenuEntry(const std::string &str, const coord_def p,
int hotkey) :
MenuEntry(str, MEL_ITEM, 1, hotkey)
{
+ if (in_bounds(p))
+ feat = grd(p);
+ else
+ feat = DNGN_UNSEEN;
pos = p;
quantity = 1;
}
+FeatureMenuEntry::FeatureMenuEntry(const std::string &str,
+ const dungeon_feature_type f,
+ int hotkey) :
+ MenuEntry(str, MEL_ITEM, 1, hotkey)
+{
+ pos.reset();
+ feat = f;
+ quantity = 1;
+}
+
+
#ifdef USE_TILE
PlayerMenuEntry::PlayerMenuEntry(const std::string &str) :
MenuEntry(str, MEL_ITEM, 1)
@@ -828,12 +843,13 @@ bool FeatureMenuEntry::get_tiles(std::vector<tile_def>& tileset) const
if (!Options.tile_menu_icons)
return (false);
- if (!in_bounds(pos))
+ if (feat == DNGN_UNSEEN)
return (false);
- tileset.push_back(tile_def(tileidx_feature(grd(pos), pos.x, pos.y),
+ tileset.push_back(tile_def(tileidx_feature(feat, pos.x, pos.y),
TEX_DUNGEON));
- if (is_unknown_stair(pos))
+
+ if (in_bounds(pos) && is_unknown_stair(pos))
tileset.push_back(tile_def(TILE_NEW_STAIR, TEX_DEFAULT));
return (true);