summaryrefslogtreecommitdiff
path: root/src/cmd2.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/cmd2.c
parent120fed37d8974553e25e5c83ba74c1bb08d71404 (diff)
Refactor: Remove duplicate code for accessing inventory/floor object
Diffstat (limited to 'src/cmd2.c')
-rw-r--r--src/cmd2.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/cmd2.c b/src/cmd2.c
index caf6d195..ba6bee63 100644
--- a/src/cmd2.c
+++ b/src/cmd2.c
@@ -3103,15 +3103,8 @@ void do_cmd_fire(void)
if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
- /* Access the item (if in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory[item];
- }
- else
- {
- o_ptr = &o_list[0 - item];
- }
+ /* Access the item */
+ o_ptr = get_object(item);
}
@@ -3523,15 +3516,8 @@ void do_cmd_throw(void)
s = "You have nothing to throw.";
if (!get_item(&item, q, s, (USE_INVEN | USE_FLOOR))) return;
- /* Access the item (if in the pack) */
- if (item >= 0)
- {
- o_ptr = &p_ptr->inventory[item];
- }
- else
- {
- o_ptr = &o_list[0 - item];
- }
+ /* Access the item */
+ o_ptr = get_object(item);
object_flags(o_ptr, &f1, &f2, &f3, &f4, &f5, &esp);