summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg-cmd.cc
diff options
context:
space:
mode:
authorRaphael Langella <raphael.langella@gmail.com>2011-01-13 17:58:04 +0100
committerRaphael Langella <raphael.langella@gmail.com>2011-01-13 20:51:00 +0100
commit7215e7eca365663c51bbae93b33dbcbb82e4b1e3 (patch)
tree40455fb44752af91a516bad6e467a944bf0ee378 /crawl-ref/source/tilereg-cmd.cc
parent5a4495603c98b85401d17196976441a0ed1dfa4f (diff)
downloadcrawl-ref-7215e7eca365663c51bbae93b33dbcbb82e4b1e3.tar.gz
crawl-ref-7215e7eca365663c51bbae93b33dbcbb82e4b1e3.zip
Check i_feel_safe just once when updating command tab.
Diffstat (limited to 'crawl-ref/source/tilereg-cmd.cc')
-rw-r--r--crawl-ref/source/tilereg-cmd.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/crawl-ref/source/tilereg-cmd.cc b/crawl-ref/source/tilereg-cmd.cc
index 9dc7d3ebd7..bd2d927dd2 100644
--- a/crawl-ref/source/tilereg-cmd.cc
+++ b/crawl-ref/source/tilereg-cmd.cc
@@ -159,14 +159,14 @@ void CommandRegion::pack_buffers()
}
}
-static bool _command_not_applicable(const command_type cmd)
+static bool _command_not_applicable(const command_type cmd, bool safe)
{
switch (cmd)
{
case CMD_REST:
case CMD_EXPLORE:
case CMD_INTERLEVEL_TRAVEL:
- return (!i_feel_safe(false));
+ return (!safe);
case CMD_DISPLAY_RELIGION:
return (you.religion == GOD_NO_GOD);
case CMD_PRAY:
@@ -187,6 +187,8 @@ void CommandRegion::update()
if (mx * my == 0)
return;
+ bool safe = i_feel_safe(false);
+
for (int idx = 0; idx < n_common_commands; ++idx)
{
const command_type cmd = _common_commands[idx];
@@ -196,7 +198,7 @@ void CommandRegion::update()
desc.idx = cmd;
// Auto-explore while monsters around etc.
- if (_command_not_applicable(cmd))
+ if (_command_not_applicable(cmd, safe))
desc.flag |= TILEI_FLAG_INVALID;
m_items.push_back(desc);