summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-15 17:02:30 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2007-05-15 17:02:30 +0000
commit778880771386e5f111aca28d397c5d32f3e7dca0 (patch)
tree3103d6f05216f29849f36419ba0ae54fb4596a2e /crawl-ref
parent21a20c8edf221604f77decc0430145d13f305e5b (diff)
downloadcrawl-ref-778880771386e5f111aca28d397c5d32f3e7dca0.tar.gz
crawl-ref-778880771386e5f111aca28d397c5d32f3e7dca0.zip
Nemelexites now require confirmation before offering runes, orbs, or
objects marked with !p (or !*) on a non-altar square. Nothing gets offered unless the player OKs everything, so inscribing a couple of items in your stash with !p should be enough paranoia. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1476 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/enum.h1
-rw-r--r--crawl-ref/source/invent.cc4
-rw-r--r--crawl-ref/source/invent.h1
-rw-r--r--crawl-ref/source/items.h1
-rw-r--r--crawl-ref/source/religion.cc35
5 files changed, 38 insertions, 4 deletions
diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h
index 7b0caa19c0..fd62ec96ba 100644
--- a/crawl-ref/source/enum.h
+++ b/crawl-ref/source/enum.h
@@ -2669,6 +2669,7 @@ enum operation_types
OPER_THROW = 't',
OPER_EXAMINE = 'v',
OPER_FIRE = 'f',
+ OPER_PRAY = 'p',
OPER_ANY = 0
};
diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc
index 17f6ad4581..d45051a80d 100644
--- a/crawl-ref/source/invent.cc
+++ b/crawl-ref/source/invent.cc
@@ -740,8 +740,8 @@ static int digit_to_index( char digit, operation_types oper ) {
return -1;
}
-static bool has_warning_inscription(const item_def& item,
- operation_types oper)
+bool has_warning_inscription(const item_def& item,
+ operation_types oper)
{
const char iletter = static_cast<char>(oper);
diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h
index 46384eeec3..882b340a25 100644
--- a/crawl-ref/source/invent.h
+++ b/crawl-ref/source/invent.h
@@ -185,5 +185,6 @@ bool in_inventory(const item_def &i);
std::string item_class_name(int type, bool terse = false);
bool check_warning_inscriptions(const item_def& item, operation_types oper);
+bool has_warning_inscription(const item_def& item, operation_types oper);
#endif
diff --git a/crawl-ref/source/items.h b/crawl-ref/source/items.h
index 2c96eab936..fbcfe4339f 100644
--- a/crawl-ref/source/items.h
+++ b/crawl-ref/source/items.h
@@ -149,5 +149,6 @@ bool need_to_autopickup();
void autopickup();
int find_free_slot(const item_def &i);
+bool is_rune(const item_def &item);
#endif
diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc
index a1d7f0ff31..8701400c2a 100644
--- a/crawl-ref/source/religion.cc
+++ b/crawl-ref/source/religion.cc
@@ -41,6 +41,7 @@
#include "describe.h"
#include "effects.h"
#include "food.h"
+#include "invent.h"
#include "it_use2.h"
#include "itemname.h"
#include "itemprop.h"
@@ -599,6 +600,30 @@ static void do_god_gift()
} // end of gift giving
}
+static bool is_risky_sacrifice(const item_def& item)
+{
+ return item.base_type == OBJ_ORBS || is_rune(item);
+}
+
+static bool confirm_pray_sacrifice()
+{
+ for ( int i = igrd[you.x_pos][you.y_pos]; i != NON_ITEM;
+ i = mitm[i].link )
+ {
+ const item_def& item = mitm[i];
+ if ( is_risky_sacrifice(item) ||
+ has_warning_inscription(item, OPER_PRAY) )
+ {
+ std::string prompt = "Really sacrifice ";
+ prompt += item.name(DESC_NOCAP_A);
+ prompt += '?';
+ if ( !yesno(prompt.c_str(), false, 'n') )
+ return false;
+ }
+ }
+ return true;
+}
+
std::string god_prayer_reaction()
{
std::string result;
@@ -683,9 +708,15 @@ void pray()
return;
}
+ // Nemelexites can abort out now instead of offering something
+ // they don't want to lose
+ if ( you.religion == GOD_NEMELEX_XOBEH && altar_god == GOD_NO_GOD &&
+ !confirm_pray_sacrifice() )
+ return;
+
mprf(MSGCH_PRAY, "You offer a prayer to %s.", god_name(you.religion));
- // Nemelexites can offer everywhere
+ // ...otherwise, they offer what they're standing on
if ( you.religion == GOD_NEMELEX_XOBEH && altar_god == GOD_NO_GOD )
offer_items();
@@ -2498,7 +2529,7 @@ void offer_items()
{
if (you.religion == GOD_NO_GOD)
return;
-
+
int i = igrd[you.x_pos][you.y_pos];
while (i != NON_ITEM)
{