Changeset 603

Show
Ignore:
Timestamp:
09/29/07 19:46:12 (1 year ago)
Author:
takkaria
Message:
  • Clean up the interface to scan_floor().
  • Fix #315.
Files:

Legend:

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

    r589 r603  
    366366                if (squelch_hide_item(o_ptr) || !o_ptr->k_idx) continue; 
    367367 
     368                /* XXX Hack -- Enforce limit */ 
     369                if (floor_num >= N_ELEMENTS(floor_list)) break; 
     370 
     371 
    368372                /* Hack -- disturb */ 
    369373                disturb(0, 0); 
     
    392396                if (inven_carry_okay(o_ptr)) 
    393397                        can_pickup++; 
    394  
    395                 /* XXX Hack -- Enforce limit */ 
    396                 if (floor_num == MAX_FLOOR_STACK) break; 
    397398        } 
    398399 
     
    438439 
    439440                                /* Scan all marked objects in the grid */ 
    440                                 (void)scan_floor(floor_list, &floor_num, py, px, 0x03); 
     441                                floor_num = scan_floor(floor_list, N_ELEMENTS(floor_list), py, px, 0x03); 
    441442 
    442443                                /* Save screen */ 
     
    480481        { 
    481482                /* Scan floor (again) */ 
    482                 (void)scan_floor(floor_list, &floor_num, py, px, 0x03); 
     483                floor_num = scan_floor(floor_list, N_ELEMENTS(floor_list), py, px, 0x03); 
    483484 
    484485                /* Use a menu interface for multiple objects, or pickup single objects */ 
  • trunk/src/externs.h

    r595 r603  
    414414extern cptr describe_use(int i); 
    415415extern bool item_tester_okay(const object_type *o_ptr); 
    416 extern bool scan_floor(int *items, int *item_num, int y, int x, int mode); 
     416extern int scan_floor(int *items, int max_size, int y, int x, int mode); 
    417417extern void display_inven(void); 
    418418extern void display_equip(void); 
  • trunk/src/object1.c

    r556 r603  
    19261926 *   0x04 -- Only the top item 
    19271927 */ 
    1928 bool scan_floor(int *items, int *item_num, int y, int x, int mode) 
     1928int scan_floor(int *items, int max_size, int y, int x, int mode) 
    19291929{ 
    19301930        int this_o_idx, next_o_idx; 
     
    19321932        int num = 0; 
    19331933 
    1934         (*item_num) = 0; 
    1935  
    19361934        /* Sanity */ 
    1937         if (!in_bounds(y, x)) return (FALSE)
     1935        if (!in_bounds(y, x)) return 0
    19381936 
    19391937        /* Scan all objects in the grid */ 
     
    19411939        { 
    19421940                object_type *o_ptr; 
     1941 
     1942                /* XXX Hack -- Enforce limit */ 
     1943                if (num >= max_size) break; 
     1944 
    19431945 
    19441946                /* Get the object */ 
     
    19601962                /* Only one */ 
    19611963                if (mode & 0x04) break; 
    1962  
    1963                 /* XXX Hack -- Enforce limit */ 
    1964                 if (num == MAX_FLOOR_STACK) break; 
    1965         } 
    1966  
    1967         /* Number of items */ 
    1968         (*item_num) = num; 
    1969  
    1970         /* Result */ 
    1971         return (num != 0); 
     1964        } 
     1965 
     1966        return num; 
    19721967} 
    19731968 
     
    28032798 
    28042799        /* Scan all non-gold objects in the grid */ 
    2805         (void)scan_floor(floor_list, &floor_num, py, px, 0x01); 
     2800        floor_num = scan_floor(floor_list, N_ELEMENTS(floor_list), py, px, 0x03); 
    28062801 
    28072802        /* Full floor */ 
  • trunk/src/squelch.c

    r542 r603  
    474474        /* Set the hook and scan the floor */ 
    475475        item_tester_hook = squelch_item_ok; 
    476         (void)scan_floor(floor_list, &floor_num, p_ptr->py, p_ptr->px, 0x01); 
     476        floor_num = scan_floor(floor_list, N_ELEMENTS(floor_list), p_ptr->py, p_ptr->px, 0x01); 
    477477 
    478478        if (floor_num) 
  • trunk/src/xtra2.c

    r542 r603  
    26162616                floored = FALSE; 
    26172617 
     2618                floor_num = scan_floor(floor_list, N_ELEMENTS(floor_list), y, x, 0x02); 
     2619 
    26182620                /* Scan all marked objects in the grid */ 
    2619                 if ((scan_floor(floor_list, &floor_num, y, x, 0x02)) && 
     2621                if ((floor_num > 0) && 
    26202622                    (!(p_ptr->timed[TMD_BLIND]) || (y == p_ptr->py && x == p_ptr->px))) 
    26212623                {