/* This should probably go to a gworld first, or something */ static void update_inventory_panel( boolean force_redraw) { short section_items[NUMBER_OF_ITEMS]; short section_counts[NUMBER_OF_ITEMS]; short section_count, loop; short item_type, current_row; if(INVENTORY_IS_DIRTY(current_player) || force_redraw) { screen_rectangle *destination= get_interface_rectangle(_inventory_rect); screen_rectangle text_rectangle; short total_inventory_line_count= count_inventory_lines(current_player_index); short max_lines= max_displayable_inventory_lines(); /* Recalculate and redraw.. */ item_type= GET_CURRENT_INVENTORY_SCREEN(current_player); /* Reset the row.. */ current_row= 0; if(item_type!=_network_statistics) { /* Get the types and names */ calculate_player_item_array(current_player_index, item_type, section_items, section_counts, §ion_count); } /* Draw the header. */ get_header_name(temporary, item_type); draw_inventory_header(temporary, current_row++); /* Draw the network time elapsed if timed game. */ if (item_type==_network_statistics && dynamic_world->game_information.game_time_remaining<60*60*TICKS_PER_SECOND) { long seconds= dynamic_world->game_information.game_time_remaining/TICKS_PER_SECOND; screen_rectangle destination; sprintf(temporary, "% 2d:%02d", seconds/60, seconds%60); calculate_inventory_rectangle_from_offset(&destination, current_row-1); destination.top -= 2; //<6/17/96 AMR> Sick hack destination.bottom -= 2; /* Now draw the text. */ destination.left+= TEXT_INSET; _draw_screen_text(temporary, &destination, _right_justified, _interface_font, _inventory_text_color); } /* Erase the panel.. */ text_rectangle= *destination; text_rectangle.top+= _get_font_line_height(_interface_font); _fill_rect(&text_rectangle, _inventory_background_color); if(item_type==_network_statistics) { struct player_ranking_data rankings[MAXIMUM_NUMBER_OF_PLAYERS]; calculate_player_rankings(rankings); /* Calculate the network statistics. */ for(loop= 0; loop<dynamic_world->player_count; ++loop) { screen_rectangle dest_rect; struct player_data *player= get_player_data(rankings[loop].player_index); short width; calculate_inventory_rectangle_from_offset(&dest_rect, current_row++); calculate_ranking_text(temporary, rankings[loop].ranking); /* Draw the player name.. */ width= _text_width(temporary, _interface_font); dest_rect.right-= width; dest_rect.left+= TEXT_INSET; _draw_screen_text(player->name, &dest_rect, _center_vertical, _interface_font, PLAYER_COLOR_BASE_INDEX+player->color); /* Now draw the ranking_text */ dest_rect.right+= width; dest_rect.left= dest_rect.right-width; _draw_screen_text(temporary, &dest_rect, _center_vertical, _interface_font, PLAYER_COLOR_BASE_INDEX+player->color); } } else { /* Draw the items. */ for(loop= 0; loop<section_count && current_row<max_lines; ++loop) { boolean valid_in_this_environment; /* Draw the item */ get_item_name(temporary, section_items[loop], (section_counts[loop]!=1)); valid_in_this_environment= item_valid_in_current_environment(section_items[loop]); draw_inventory_item(temporary, section_counts[loop], current_row++, FALSE, valid_in_this_environment); } } SET_INVENTORY_DIRTY_STATE(current_player, FALSE); } return; }
int bb_litehtml_document_container::text_width( const litehtml::tchar_t *text,litehtml::uint_ptr hFont ){ bbObject *font=(bbObject*)hFont; return _text_width( text,font ); }