diff options
author | Bardur Arantsson <bardur@scientician.net> | 2012-03-04 17:47:43 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2012-03-29 20:41:39 +0200 |
commit | 4d6770696a172bae4ef18a00cb1e59f06e641faf (patch) | |
tree | 6b6475485d731f4ad2a54c84dacfaafec347f8a9 /src/cmd5.c | |
parent | 120fed37d8974553e25e5c83ba74c1bb08d71404 (diff) |
Refactor: Remove duplicate code for accessing inventory/floor object
Diffstat (limited to 'src/cmd5.c')
-rw-r--r-- | src/cmd5.c | 26 |
1 files changed, 4 insertions, 22 deletions
@@ -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); |