Changeset 245

Show
Ignore:
Timestamp:
06/30/07 21:17:41 (1 year ago)
Author:
takkaria
Message:
  • Outline new pickup option scheme outlined in #177.
  • Also, make "=g" work again.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/cmd1.c

    r234 r245  
    491491 
    492492/* 
    493  * Determine if the object can be picked up automatically
     493 * Pickup all gold at the player's current location
    494494 */ 
    495 static bool auto_pickup_okay(const object_type *o_ptr, bool check_pack) 
    496 
    497         const char *inscrip = (o_ptr->note ? quark_str(o_ptr->note) : NULL); 
    498         const char *s; 
    499  
    500         /*** Negative checks ***/ 
    501  
    502         /* It can't be carried */ 
    503         if (!inven_carry_okay(o_ptr)) return (FALSE); 
    504  
    505         /* Ignore squelched items */ 
    506         if (inscrip && streq(inscrip, "squelch")) return (FALSE); 
    507  
    508  
    509  
    510         /*** Positive checks ***/ 
    511  
    512         /* Pickup if it matches the inventory */ 
    513         if (pickup_inven && inven_stack_okay(o_ptr)) return (TRUE); 
    514  
    515         /* Option to vacuum up things on the floor (not recommended) */ 
    516         if (always_pickup && !query_floor) return (TRUE); 
    517  
    518         /* Check inscription */ 
    519         if (o_ptr->note) 
    520         { 
    521                 /* Find a '=' */ 
    522                 s = strchr(quark_str(o_ptr->note), '='); 
    523  
    524                 /* Process permissions */ 
    525                 while (s) 
    526                 { 
    527                         /* =g ('g'et) means auto pickup */ 
    528                         if (s[1] == 'g') return (TRUE); 
    529  
    530                         /* Find another '=' */ 
    531                         s = strchr(s + 1, '='); 
    532                 } 
    533         } 
    534  
    535         /* Don't auto pickup */ 
    536         return (FALSE); 
    537 
    538  
    539  
    540 /* 
    541  * Carry an object and delete it. 
    542  */ 
    543 static void py_pickup_aux(int o_idx, bool msg) 
    544 
    545         int slot; 
    546  
    547         char o_name[80]; 
    548         object_type *o_ptr = &o_list[o_idx]; 
    549  
    550         /* Carry the object */ 
    551         slot = inven_carry(o_ptr); 
    552  
    553         /* Handle errors (paranoia) */ 
    554         if (slot < 0) return; 
    555  
    556         /* Get the new object */ 
    557         o_ptr = &inventory[slot]; 
    558  
    559         /* Set squelch status */ 
    560         squelch_set(o_ptr); 
    561  
    562         /* Optionally, display a message */ 
    563         if (msg) 
    564         { 
    565                 /* Describe the object */ 
    566                 object_desc(o_name, sizeof(o_name), o_ptr, TRUE, 3); 
    567  
    568                 /* Message */ 
    569                 msg_format("You have %s (%c).", o_name, index_to_label(slot)); 
    570         } 
    571  
    572         /* Delete the object */ 
    573         delete_object_idx(o_idx); 
    574 
    575  
    576  
    577 /* 
    578  * Pick up objects and treasure on the floor.  -LM- 
    579  * 
    580  * Called with pickup: 
    581  * 0 to grab gold, auto-pickup some objects, and describe others objects. 
    582  * 1 to pick up objects either with or without displaying a menu. 
    583  * 2 to pick up objects, allowing cancel and quick pickup of single objects. 
    584  * 3 to pick up objects, forcing a menu for any number of objects. 
    585  * 
    586  * Scan the list of objects in that floor grid.   Pick up gold automatically. 
    587  * Pick up objects automatically until pile or backpack space is full if 
    588  * auto-pickup option is on, carry_query_floor option is not, and menus are 
    589  * not forced (which the "get" command does). Otherwise, store objects on 
    590  * floor in an array, and tally both how many there are and can be picked up. 
    591  * 
    592  * If not picking up anything, indicate objects on the floor.  Show more 
    593  * details if the "query_floor" option is set.  Do the same thing if we 
    594  * don't have room for anything. 
    595  * 
    596  * If we are picking up objects automatically, and have room for at least 
    597  * one, allow the "query_floor" option to display information about objects 
    598  * and prompt the player.  Otherwise, automatically pick up a single object 
    599  * or use a menu for more than one (this "blind" autopickup option is 
    600  * deprecated). 
    601  * 
    602  * Pick up multiple objects using Tim Baker's menu system.   Recursively 
    603  * call this function (forcing menus for any number of objects) until 
    604  * objects are gone, backpack is full, or player is satisfied. 
    605  * 
    606  * We keep track of number of objects picked up to calculate time spent. 
    607  * This tally is incremented even for automatic pickup, so we are careful 
    608  * (in "dungeon.c" and elsewhere) to handle pickup as either a separate 
    609  * automated move or a no-cost part of the stay still or 'g'et command. 
    610  * 
    611  * Note the lack of chance for the character to be disturbed by unmarked 
    612  * objects.  They are truly "unknown". 
    613  */ 
    614 byte py_pickup(int pickup) 
     495static bool py_pickup_gold(void) 
    615496{ 
    616497        int py = p_ptr->py; 
    617498        int px = p_ptr->px; 
    618499 
     500        s32b total_gold = 0L; 
     501        byte *treasure; 
     502 
    619503        char o_name[80]; 
    620         char ch
     504        char buf[1024]
    621505 
    622506        s16b this_o_idx, next_o_idx = 0; 
    623507 
    624508        object_type *o_ptr; 
    625  
    626         /* Objects picked up.  Used to determine time cost of command. */ 
    627         byte objs_picked_up = 0; 
    628  
    629         int floor_num = 0, floor_list[MAX_FLOOR_STACK + 1], floor_o_idx = 0; 
    630509 
    631510        int can_pickup = 0; 
     
    634513 
    635514        bool blind = ((p_ptr->timed[TMD_BLIND]) || (no_lite())); 
    636  
    637         bool force_display_list = FALSE; 
    638515        bool msg = TRUE; 
    639  
    640         s32b total_gold = 0L; 
    641         byte *treasure; 
    642  
    643  
    644         /* Nothing to pick up -- return */ 
    645         if (!cave_o_idx[py][px]) return (0); 
    646516 
    647517 
     
    757627        /* Free the gold array */ 
    758628        FREE(treasure); 
     629} 
     630 
     631 
     632 
     633/* 
     634 * Determine if the object can be picked up automatically. 
     635 */ 
     636static bool auto_pickup_okay(const object_type *o_ptr) 
     637{ 
     638        const char *s; 
     639 
     640        /*** Negative checks ***/ 
     641 
     642        /* It can't be carried */ 
     643        if (!inven_carry_okay(o_ptr)) return (FALSE); 
     644 
     645 
     646        /*** Positive checks ***/ 
     647 
     648        /* Pickup if it matches the inventory */ 
     649        if (pickup_inven && inven_stack_okay(o_ptr)) return (TRUE); 
     650 
     651        /* Vacuum up everything if requested */ 
     652        if (pickup_always) return (TRUE); 
     653 
     654        /* Check inscription */ 
     655        if (o_ptr->note) 
     656        { 
     657                /* Find a '=' */ 
     658                s = strchr(quark_str(o_ptr->note), '='); 
     659 
     660                /* Process permissions */ 
     661                while (s) 
     662                { 
     663                        /* =g ('g'et) means auto pickup */ 
     664                        if (s[1] == 'g') return (TRUE); 
     665 
     666                        /* Find another '=' */ 
     667                        s = strchr(s + 1, '='); 
     668                } 
     669        } 
     670 
     671        /* Don't auto pickup */ 
     672        return (FALSE); 
     673} 
     674 
     675 
     676/* 
     677 * Carry an object and delete it. 
     678 */ 
     679static void py_pickup_aux(int o_idx, bool msg) 
     680{ 
     681        int slot; 
     682 
     683        char o_name[80]; 
     684        object_type *o_ptr = &o_list[o_idx]; 
     685 
     686        /* Carry the object */ 
     687        slot = inven_carry(o_ptr); 
     688 
     689        /* Handle errors (paranoia) */ 
     690        if (slot < 0) return; 
     691 
     692        /* Get the new object */ 
     693        o_ptr = &inventory[slot]; 
     694 
     695        /* Set squelch status */ 
     696        squelch_set(o_ptr); 
     697 
     698        /* Optionally, display a message */ 
     699        if (msg) 
     700        { 
     701                /* Describe the object */ 
     702                object_desc(o_name, sizeof(o_name), o_ptr, TRUE, 3); 
     703 
     704                /* Message */ 
     705                msg_format("You have %s (%c).", o_name, index_to_label(slot)); 
     706        } 
     707 
     708        /* Delete the object */ 
     709        delete_object_idx(o_idx); 
     710} 
     711 
     712 
     713/* 
     714 * Pick up objects and treasure on the floor.  -LM- 
     715 * 
     716 * Called with pickup: 
     717 * 0 to act according to the player's settings 
     718 * 1 to quickly pickup single objects and present a menu for more 
     719 * 2 to force a menu for any number of objects 
     720 * 
     721 * Scan the list of objects in that floor grid.   Pick up gold automatically. 
     722 * Pick up objects automatically until pile or backpack space is full if 
     723 * auto-pickup option is on, carry_query_floor option is not, and menus are 
     724 * not forced (which the "get" command does). Otherwise, store objects on 
     725 * floor in an array, and tally both how many there are and can be picked up. 
     726 * 
     727 * If not picking up anything, indicate objects on the floor.  Show more 
     728 * details if the "pickup_detail" option is set.  Do the same thing if we 
     729 * don't have room for anything. 
     730 * 
     731 * If we are picking up objects automatically, and have room for at least 
     732 * one, allow the "pickup_detail" option to display information about objects 
     733 * and prompt the player.  Otherwise, automatically pick up a single object 
     734 * or use a menu for more than one. 
     735 * 
     736 * Pick up multiple objects using Tim Baker's menu system.   Recursively 
     737 * call this function (forcing menus for any number of objects) until 
     738 * objects are gone, backpack is full, or player is satisfied. 
     739 * 
     740 * We keep track of number of objects picked up to calculate time spent. 
     741 * This tally is incremented even for automatic pickup, so we are careful 
     742 * (in "dungeon.c" and elsewhere) to handle pickup as either a separate 
     743 * automated move or a no-cost part of the stay still or 'g'et command. 
     744 * 
     745 * Note the lack of chance for the character to be disturbed by unmarked 
     746 * objects.  They are truly "unknown". 
     747 */ 
     748byte py_pickup(int pickup) 
     749{ 
     750        int py = p_ptr->py; 
     751        int px = p_ptr->px; 
     752 
     753        char o_name[80]; 
     754        char ch; 
     755 
     756        s16b this_o_idx, next_o_idx = 0; 
     757 
     758        object_type *o_ptr; 
     759 
     760        /* Objects picked up.  Used to determine time cost of command. */ 
     761        byte objs_picked_up = 0; 
     762 
     763        int floor_num = 0, floor_list[MAX_FLOOR_STACK + 1], floor_o_idx = 0; 
     764 
     765        int can_pickup = 0; 
     766        bool call_function_again = FALSE; 
     767        int sound_msg; 
     768 
     769        bool blind = ((p_ptr->timed[TMD_BLIND]) || (no_lite())); 
     770        bool msg = TRUE; 
     771 
     772 
     773        /* Nothing to pick up -- return */ 
     774        if (!cave_o_idx[py][px]) return (0); 
     775 
     776 
     777        /* Always pickup gold, effortlessly */ 
     778        py_pickup_gold(); 
    759779 
    760780 
     
    762782        for (this_o_idx = cave_o_idx[py][px]; this_o_idx; this_o_idx = next_o_idx) 
    763783        { 
    764                 /* Get the object */ 
     784                /* Get the object and the next object */ 
    765785                o_ptr = &o_list[this_o_idx]; 
    766  
    767                 /* Get the next object */ 
    768786                next_o_idx = o_ptr->next_o_idx; 
    769787 
    770                 /* Ignore all hidden objects */ 
    771                 if (squelch_hide_item(o_ptr)) continue; 
    772  
    773                 /* Paranoia -- ignore all dead objects  XXX */ 
    774                 if (!o_ptr->k_idx) continue; 
     788                /* Ignore all hidden objects and non-objects */ 
     789                if (squelch_hide_item(o_ptr) || !o_ptr->k_idx) continue; 
    775790 
    776791                /* Hack -- disturb */ 
     
    779794 
    780795                /* Automatically pick up items into the backpack */ 
    781                 if (p_ptr->auto_pickup_okay && auto_pickup_okay(o_ptr, TRUE)) 
    782                 { 
    783                         /* Pick up the object (with a message) */ 
     796                if (p_ptr->auto_pickup_okay && auto_pickup_okay(o_ptr)) 
     797                { 
     798                        /* Pick up the object with message */ 
    784799                        py_pickup_aux(this_o_idx, TRUE); 
    785  
    786                         /* Take a small amount of time */ 
    787800                        objs_picked_up++; 
     801 
    788802                        continue; 
    789803                } 
     804 
    790805 
    791806                /* Tally objects and store them in an array. */ 
     
    797812                floor_num++; 
    798813 
    799                 /* Remember this index */ 
    800                 floor_o_idx = this_o_idx; 
    801  
    802814                /* Tally objects that can be picked up.*/ 
    803815                if (inven_carry_okay(o_ptr)) 
    804                 { 
    805816                        can_pickup++; 
    806                 } 
    807817 
    808818                /* XXX Hack -- Enforce limit */ 
     
    811821 
    812822        /* There are no objects left */ 
    813         if (!floor_num) return (objs_picked_up); 
     823        if (!floor_num) 
     824                return objs_picked_up; 
     825 
     826 
     827        /* Get hold of the last floor index */ 
     828        floor_o_idx = floor_list[floor_num - 1]; 
     829 
    814830 
    815831 
    816832        /* Mention the objects if player is not picking them up. */ 
    817         if (!pickup) 
    818         { 
    819                 /* Optionally, display more information about floor items */ 
    820                 if ((query_floor) && (floor_num > 1)) 
    821                 { 
    822                         /* Scan all marked objects in the grid */ 
    823                         (void)scan_floor(floor_list, &floor_num, py, px, 0x03); 
    824  
    825                         /* Save screen */ 
    826                         screen_save(); 
    827  
    828                         /* Display objects on the floor */ 
    829                         show_floor(floor_list, floor_num, FALSE); 
    830  
    831                         /* Display prompt */ 
    832                         prt(format("You %s: ", 
    833                             (blind ? "feel something on the floor" : "see")), 0, 0); 
    834  
    835                         /* Move cursor back to character, if needed */ 
    836                         if (hilite_player) move_cursor_relative(p_ptr->py, p_ptr->px); 
    837  
    838                         /* Wait for it.  Use key as next command. */ 
    839                         p_ptr->command_new = inkey(); 
    840  
    841                         /* Restore screen */ 
    842                         screen_load(); 
    843                 } 
    844  
    845                 /* Display compact information */ 
    846                 else 
    847                 { 
    848                         /* One object */ 
    849                         if (floor_num == 1) 
    850                         { 
    851                                 /* Get the object */ 
    852                                 o_ptr = &o_list[floor_o_idx]; 
    853  
    854                                 /* Describe the object.  Less detail if blind. */ 
    855                                 if (blind) object_desc(o_name, sizeof(o_name), o_ptr, TRUE, 0); 
    856                                 else       object_desc(o_name, sizeof(o_name), o_ptr, TRUE, 3); 
    857  
    858                                 message_flush(); 
    859  
    860                                 /* Message */ 
    861                                 msg_format("You %s %s.", (blind ? "feel" : "see"), 
    862                                         o_name); 
    863                         } 
    864  
    865                         /* Several objects */ 
    866                         else 
    867                         { 
    868                                 message_flush(); 
    869  
    870                                 /* Message */ 
    871                                 msg_format("You %s a pile of %d items.", 
    872                                         (blind ? "feel" : "see"), floor_num); 
    873                         } 
    874                 } 
    875  
    876                 /* Done */ 
    877                 return (objs_picked_up); 
    878         } 
    879  
    880  
    881         /* The player has no room for anything on the floor. */ 
    882         if (!can_pickup) 
    883         { 
    884                 /* 
    885                  * One object -- Always display compact information.  This 
    886                  * should change if more information would actually be helpful. 
    887                  */ 
     833        if (pickup == 0 || !can_pickup) 
     834        { 
     835                const char *p = "see"; 
     836 
     837                /* One object */ 
    888838                if (floor_num == 1) 
    889839                { 
     840                        if (blind)            p = "feel"; 
     841                        else if (!can_pickup) p = "have no room for"; 
     842 
    890843                        /* Get the object */ 
    891844                        o_ptr = &o_list[floor_o_idx]; 
     
    897850                        /* Message */ 
    898851                        message_flush(); 
    899                         msg_format("You have no room for %s.", o_name); 
    900                 } 
    901  
    902                 /* Several items */ 
     852                        msg_format("You %s %s.", p, o_name); 
     853                } 
    903854                else 
    904855                { 
    905856                        /* Optionally, display more information about floor items */ 
    906                         if ((query_floor) || (force_display_list)) 
    907                         { 
     857                        if (pickup_detail) 
     858                        { 
     859                                if (blind)            p = "feel something on the floor"; 
     860                                else if (!can_pickup) p = "have no room for the following objects"; 
     861 
    908862                                /* Scan all marked objects in the grid */ 
    909863                                (void)scan_floor(floor_list, &floor_num, py, px, 0x03); 
     
    916870 
    917871                                /* Display prompt */ 
    918                                 prt("You have no room for the following objects: ", 0, 0); 
     872                                prt(format("You %s: ", p), 0, 0); 
    919873 
    920874                                /* Move cursor back to character, if needed */ 
     
    928882                        } 
    929883 
    930                         /* Display compact information */ 
     884                        /* Show less detail */ 
    931885                        else 
    932886                        { 
    933                                 /* Message -- not very informative */ 
    934887                                message_flush(); 
    935                                 msg_print("You have no room for any of the items on the floor."); 
     888 
     889                                if (!can_pickup) 
     890                                        msg_print("You have no room for any of the items on the floor."); 
     891                                else 
     892                                        msg_format("You %s a pile of %d items.", (blind ? "feel" : "see"), floor_num); 
    936893                        } 
    937894                } 
     
    943900 
    944901        /* We can pick up objects.  Menus are not requested (yet). */ 
    945         if (pickup != 3
    946         { 
    947                 /* Scan all marked objects in the grid (again) */ 
     902        if (pickup == 1
     903        { 
     904                /* Scan floor (again) */ 
    948905                (void)scan_floor(floor_list, &floor_num, py, px, 0x03); 
    949906 
    950                 /* 
    951                  * If not deliberately picking up objects, and if requested or 
    952                  * potentially unsafe, ask the player to confirm all pickups. 
    953                  */ 
    954                 if (((query_floor) || (!p_ptr->auto_pickup_okay)) && (pickup <= 1)) 
    955                 { 
    956                         /* Save screen */ 
    957                         screen_save(); 
    958  
    959                         /* Display objects on the floor */ 
    960                         show_floor(floor_list, floor_num, FALSE); 
    961  
    962                         /* Display prompt */ 
    963                         if (floor_num == 1) 
    964                         { 
    965                                 prt("Press Return to pick up this object: ", 0, 0); 
    966                         } 
    967                         else 
    968                         { 
    969                                 prt("Press Return to pick up any of the following objects: ", 
    970                                         0, 0); 
    971                         } 
    972  
    973                         /* Move cursor back to character, if needed */ 
    974                         if (hilite_player) move_cursor_relative(p_ptr->py, p_ptr->px); 
    975  
    976                         /* Get response */ 
    977                         ch = inkey(); 
    978  
    979                         /* Restore screen */ 
    980                         screen_load(); 
    981  
    982                         /* We don't want to pick up this item */ 
    983                         if ((ch != '\r') && (ch != '\n') && (ch != 'g')) 
    984                         { 
    985                                 /* Attempt to turn this command into a direction */ 
    986                                 int dir = target_dir(ch); 
    987  
    988                                 /* We used a movement command */ 
    989                                 if (dir) 
    990                                 { 
    991                                         /* Save as a new command; move later */ 
    992                                         p_ptr->command_new = ch; 
    993                                 } 
    994  
    995                                 /* Done */ 
    996                                 return (objs_picked_up); 
    997                         } 
    998                 } 
    999  
    1000                 /* Use a menu interface for multiple objects */ 
     907                /* Use a menu interface for multiple objects, or pickup single objects */ 
    1001908                if (floor_num > 1) 
    1002                 { 
    1003                         pickup = 3; 
    1004                 } 
    1005  
    1006                 /* Automatically pick up a single object */ 
     909                        pickup = 2; 
    1007910                else 
    1008                 { 
    1009                         /* Remember the object to pick up */ 
    1010911                        this_o_idx = floor_o_idx; 
    1011                
    1012         } 
     912       
     913 
    1013914 
    1014915        /* Display a list if requested. */ 
    1015         if (pickup == 3
     916        if (pickup == 2
    1016917        { 
    1017918                cptr q, s; 
    1018  
    1019919                int item; 
    1020920 
     
    1028928                q = "Get which item?"; 
    1029929                s = "You see nothing there."; 
    1030                 if (get_item(&item, q, s, (USE_FLOOR))) 
    1031                 { 
    1032                         this_o_idx = 0 - item; 
    1033                         call_function_again = TRUE; 
    1034                 } 
    1035                 else 
    1036                 { 
     930                if (!get_item(&item, q, s, USE_FLOOR)) 
    1037931                        return (objs_picked_up); 
    1038                 } 
     932                 
     933                this_o_idx = 0 - item; 
     934                call_function_again = TRUE; 
    1039935 
    1040936                /* With a list, we do not need explicit pickup messages */ 
     
    1056952         * up.  Force the display of a menu in all cases. 
    1057953         */ 
    1058         if (call_function_again) objs_picked_up += py_pickup(3); 
     954        if (call_function_again) objs_picked_up += py_pickup(2); 
    1059955 
    1060956        /* Indicate how many objects have been picked up. */ 
     
    16521548 
    16531549                        /* Handle objects now.  XXX */ 
    1654                         p_ptr->energy_use = py_pickup(1) * 10; 
     1550                        p_ptr->energy_use = py_pickup(2) * 10; 
    16551551                } 
    16561552 
  • trunk/src/cmd2.c

    r227 r245  
    21932193 
    21942194        /* Handle objects now.  XXX XXX XXX */ 
    2195         p_ptr->energy_use += py_pickup(always_pickup) * 10; 
     2195        p_ptr->energy_use += py_pickup(0) * 10; 
    21962196 
    21972197        /* Hack -- enter a store if we are on one */ 
     
    22202220 
    22212221        /* Pick up floor objects, forcing a menu for multiple objects. */ 
    2222         energy_cost = py_pickup(2) * 10; 
     2222        energy_cost = py_pickup(1) * 10; 
    22232223 
    22242224        /* Maximum time expenditure is a full turn. */ 
  • trunk/src/defines.h

    r235 r245  
    23912391#define OPT_quick_messages                      1 
    23922392#define OPT_use_sound               2 
    2393 #define OPT_query_floor                               3 
     2393#define OPT_pickup_detail                     3 
    23942394#define OPT_use_old_target                      4 
    2395 #define OPT_always_pickup                     5 
     2395#define OPT_pickup_always                     5 
    23962396#define OPT_pickup_inven                        6 
    23972397#define OPT_depth_in_feet                       7 
     
    24872487#define quick_messages                  OPTION(quick_messages) 
    24882488#define use_sound                               OPTION(use_sound) 
    2489 #define query_floor                            OPTION(query_floor
     2489#define pickup_detail                  OPTION(pickup_detail
    24902490#define use_old_target                  OPTION(use_old_target) 
    2491 #define always_pickup                  OPTION(always_pickup
     2491#define pickup_always                  OPTION(pickup_always
    24922492#define pickup_inven                    OPTION(pickup_inven) 
    24932493#define depth_in_feet                   OPTION(depth_in_feet) 
  • trunk/src/dungeon.c

    r227 r245  
    12741274                { 
    12751275                        /* Recursively call the pickup function, use energy */ 
    1276                         p_ptr->energy_use = py_pickup(always_pickup) * 10; 
     1276                        p_ptr->energy_use = py_pickup(0) * 10; 
    12771277                        p_ptr->notice &= ~(PN_PICKUP); 
    12781278                } 
  • trunk/src/h-basic.h

    r207 r245  
    261261 
    262262 
    263 /*** Useful array length macro ***/ 
    264  
    265 /* 
    266  * Given an array, determine how many elements are in the array
     263/*** Useful fairly generic macros ***/ 
     264 
     265/* 
     266 * Given an array, determine how many elements are in it
    267267 */ 
    268268#define N_ELEMENTS(a) (sizeof(a) / sizeof((a)[0])) 
     269 
     270/* 
     271 * Return "s" (or not) depending on whether n is singular. 
     272 */ 
     273#define PLURAL(n)               ((n) == 1 ? "" : "s") 
    269274 
    270275 
  • trunk/src/squelch.c

    r236 r245  
    316316 * Determines if an object is eligable for squelching. 
    317317 */ 
    318 static bool squelch_item_ok(object_type *o_ptr) 
     318static bool squelch_item_ok(const object_type *o_ptr) 
    319319{ 
    320320        size_t i; 
     
    441441void squelch_set(object_type *o_ptr) 
    442442{ 
    443         bool can_squelch; 
    444  
    445         /* Check if we can squelch */ 
    446         can_squelch = squelch_item_ok(o_ptr); 
    447  
    448443        /* Set squelch inscription unless there's already one */ 
    449         if (!o_ptr->note && can_squelch) 
    450         { 
    451                 o_ptr->note = quark_add("squelch"); 
     444        if (squelch_item_ok(o_ptr)) 
    452445                p_ptr->notice = PN_SQUELCH; 
    453         } 
    454  
    455446 
    456447        /* Done */ 
     
    458449} 
    459450 
    460  
    461 /* 
    462  * An item_tester_hook for squelched items. 
    463  */ 
    464 static bool item_tester_squelched(const object_type *o_ptr) 
    465 { 
    466         const char *inscrip = (o_ptr->note ? quark_str(o_ptr->note) : NULL); 
    467  
    468         /* Check for inscription */ 
    469         if (!o_ptr->note) return FALSE; 
    470  
    471         /* Find "squelch" */ 
    472         if (inscrip && streq(inscrip, "squelch")) return TRUE; 
    473  
    474         /* Nope */ 
    475         return FALSE; 
    476 } 
    477451 
    478452 
     
    491465 
    492466        /* Set the hook and scan the floor */ 
    493         item_tester_hook = item_tester_squelched
     467        item_tester_hook = squelch_item_ok
    494468        (void)scan_floor(floor_list, &floor_num, p_ptr->py, p_ptr->px, 0x01); 
    495469 
     
    542516                p_ptr->notice |= (PN_COMBINE | PN_REORDER); 
    543517        } 
    544         else 
    545         { 
    546                 message(MSG_GENERIC, 0, "No squelched items to destroy."); 
    547         } 
    548  
    549         /* Happy now I've sold my soul */ 
    550         return; 
    551518} 
    552519 
  • trunk/src/tables.c

    r235 r245  
    14001400        "quick_messages",                       /* OPT_quick_messages */ 
    14011401        "use_sound",                            /* OPT_use_sound */ 
    1402         "query_floor",                         /* OPT_query_floor */ 
     1402        "pickup_detail",                       /* OPT_pickup_detail */ 
    14031403        "use_old_target",                       /* OPT_use_old_target */ 
    1404         "always_pickup",                       /* OPT_always_pickup */ 
     1404        "pickup_always",                       /* OPT_pickup_always */ 
    14051405        "pickup_inven",                         /* OPT_pickup_inven */ 
    14061406        "depth_in_feet",                        /* OPT_depth_in_feet */ 
     
    16641664        "Activate quick messages",                                      /* OPT_quick_messages */ 
    16651665        "Use sound",                                                            /* OPT_use_sound */ 
    1666         "Display things before picking them up",       /* OPT_query_floor */ 
     1666        "Be verbose when picking things up",           /* OPT_pickup_detail */ 
    16671667        "Use old target by default",                            /* OPT_use_old_target */ 
    1668         "Pick things up by default",                           /* OPT_always_pickup */ 
     1668        "Always pickup items",                                         /* OPT_pickup_always */ 
    16691669        "Always pickup items matching inventory",       /* OPT_pickup_inven */ 
    16701670        "Show dungeon level in feet",                           /* OPT_depth_in_feet */ 
     
    21942194                OPT_rogue_like_commands, 
    21952195                OPT_use_old_target, 
    2196                 OPT_always_pickup, 
    2197                 OPT_query_floor, 
     2196                OPT_pickup_always, 
    21982197                OPT_pickup_inven, 
     2198                OPT_pickup_detail, 
    21992199                OPT_auto_squelch, 
    22002200                OPT_easy_alter,