summaryrefslogtreecommitdiff
path: root/src/cmd5.c
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2012-03-04 17:47:43 +0100
committerBardur Arantsson <bardur@scientician.net>2012-03-29 20:41:39 +0200
commit4d6770696a172bae4ef18a00cb1e59f06e641faf (patch)
tree6b6475485d731f4ad2a54c84dacfaafec347f8a9 /src/cmd5.c
parent120fed37d8974553e25e5c83ba74c1bb08d71404 (diff)
Refactor: Remove duplicate code for accessing inventory/floor object
Diffstat (limited to 'src/cmd5.c')
-rw-r--r--src/cmd5.c26
1 files changed, 4 insertions, 22 deletions
diff --git a/src/cmd5.c b/src/cmd5.c
index 8495f562..b415b166 100644
--- a/src/cmd5.c
+++ b/src/cmd5.c
@@ -131,17 +131,8 @@ void do_cmd_browse(void)
s = "You have no books that you can read.";
if (!get_item(&item, q, s, (USE_INVEN | USE_EQUIP | USE_FLOOR))) return;
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = &o_list[0 - item];
- }
+ /* Get the item */
+ o_ptr = get_object(item);
do_cmd_browse_aux(o_ptr);
}
@@ -2198,17 +2189,8 @@ s32b get_school_spell(cptr do_what, cptr check_fct, s16b force_book)
sprintf(buf3, "%s from which book?", do_what);
if (!get_item(&item, buf3, buf2, USE_INVEN | USE_EQUIP | USE_EXTRA )) return -1;
- /* Get the item (in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory[item];
- }
-
- /* Get the item (on the floor) */
- else
- {
- o_ptr = &o_list[0 - item];
- }
+ /* Get the item */
+ o_ptr = get_object(item);
object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp);