Changeset 554

Show
Ignore:
Timestamp:
09/14/07 14:47:02 (1 year ago)
Author:
takkaria
Message:

Refactor the autopickup checking code in thje hope that #347 goes away.

Files:

Legend:

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

    r522 r554  
    241241static bool auto_pickup_okay(const object_type *o_ptr) 
    242242{ 
    243         const char *s; 
    244  
    245         /*** Negative checks ***/ 
    246  
    247         /* It can't be carried */ 
    248         if (!inven_carry_okay(o_ptr)) return (FALSE); 
    249  
    250  
    251         /*** Positive checks ***/ 
    252  
    253         /* Pickup if it matches the inventory */ 
    254         if (pickup_inven && inven_stack_okay(o_ptr)) return (TRUE); 
    255  
    256         /* Vacuum up everything if requested */ 
    257         if (pickup_always) return (TRUE); 
    258  
    259         /* Check inscription */ 
    260         if (o_ptr->note) 
    261         { 
    262                 /* Find a '=' */ 
    263                 s = strchr(quark_str(o_ptr->note), '='); 
    264  
    265                 /* Process permissions */ 
    266                 while (s) 
    267                 { 
    268                         /* =g ('g'et) means auto pickup */ 
    269                         if (s[1] == 'g') return (TRUE); 
    270  
    271                         /* Find another '=' */ 
    272                         s = strchr(s + 1, '='); 
    273                 } 
    274         } 
    275  
    276         /* Don't auto pickup */ 
    277         return (FALSE); 
     243        if (!inven_carry_okay(o_ptr)) return FALSE; 
     244 
     245        if (OPT(pickup_inven) && inven_stack_okay(o_ptr)) return TRUE; 
     246        if (OPT(pickup_always) || check_for_inscrip(o_ptr, "=g")) return TRUE; 
     247 
     248        return FALSE; 
    278249} 
    279250