summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-goditem.cc
diff options
context:
space:
mode:
authorSteve Melenchuk <smelenchuk@gmail.com>2014-03-01 22:24:34 -0700
committerSteve Melenchuk <smelenchuk@gmail.com>2014-03-01 22:29:12 -0700
commit8965cfaeaf5031f6bf24bdef5d686d4090f7f50c (patch)
tree14252cd35ab3e0389d661b00ba8aac6ebe601d3d /crawl-ref/source/spl-goditem.cc
parent7bbdbfb4c8d38454437051ac89c9d7d541fb87a9 (diff)
downloadcrawl-ref-8965cfaeaf5031f6bf24bdef5d686d4090f7f50c.tar.gz
crawl-ref-8965cfaeaf5031f6bf24bdef5d686d4090f7f50c.zip
Finish making all scrolls read ID.
This includes identify, enchant armour, and recharging. A lot of now-unnecessary code goes away with this.
Diffstat (limited to 'crawl-ref/source/spl-goditem.cc')
-rw-r--r--crawl-ref/source/spl-goditem.cc30
1 files changed, 26 insertions, 4 deletions
diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc
index e58d1f700d..c53fbb785b 100644
--- a/crawl-ref/source/spl-goditem.cc
+++ b/crawl-ref/source/spl-goditem.cc
@@ -43,7 +43,7 @@
#include "traps.h"
#include "view.h"
-int identify(int power, int item_slot, string *pre_msg)
+int identify(int power, int item_slot, bool alreadyknown, string *pre_msg)
{
int id_used = 1;
int identified = 0;
@@ -61,8 +61,30 @@ int identify(int power, int item_slot, string *pre_msg)
MT_INVLIST, OSEL_UNIDENT, true, true, false, 0,
-1, NULL, OPER_ANY, true);
}
- if (prompt_failed(item_slot))
- return identified;
+
+ if (item_slot == PROMPT_NOTHING)
+ {
+ return identified > 0 ? identified :
+ alreadyknown ? 0 : -1;
+ }
+
+ if (item_slot == PROMPT_ABORT)
+ {
+ if (alreadyknown
+ || crawl_state.seen_hups
+ || yesno("Really abort (and waste the scroll)?", false, 0))
+ {
+ canned_msg(MSG_OK);
+ return identified > 0 ? identified :
+ alreadyknown || crawl_state.seen_hups ? 0
+ : -1;
+ }
+ else
+ {
+ item_slot = -1;
+ continue;
+ }
+ }
item_def& item(you.inv[item_slot]);
@@ -76,7 +98,7 @@ int identify(int power, int item_slot, string *pre_msg)
continue;
}
- if (pre_msg && identified == 0)
+ if (alreadyknown && pre_msg && identified == 0)
mpr(pre_msg->c_str());
set_ident_type(item, ID_KNOWN_TYPE);