Changeset 999 for trunk/src/cmd3.c

Show
Ignore:
Timestamp:
10/01/08 02:49:29 (3 months ago)
Author:
takkaria
Message:
  • Create a new struct, player_state, and put everything that gets calculated dynamically there.
  • Make calc_bonuses() take a pointer to a player_state struct and only update information there, not in p_ptr->state.
  • Simplify a fair chunk of code because of the above.
  • Optimise calc_bonuses() by gathering the collective flags of the inventory before checking them for how to update the player_state struct.

This change makes it much easier to fix #498 in a useful way, along with adding other information to object information screens.

Files:

Legend:

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

    r993 r999  
    4343        prt(format("(Inventory) Burden %d.%dlb (%d%% capacity). Command: ", 
    4444            p_ptr->total_weight / 10, p_ptr->total_weight % 10, 
    45             (10 * p_ptr->total_weight) / (6 * adj_str_wgt[p_ptr->stat_ind[A_STR]])), 0, 0); 
     45            (10 * p_ptr->total_weight) / (6 * adj_str_wgt[p_ptr->state.stat_ind[A_STR]])), 0, 0); 
    4646 
    4747        /* Hack -- Get a new command */