virtual void select(int entnum, uimenu *menu) { const int starty = 3; const int startx = menu->w_width - menu->pad_right; itype *ity = item_controller->find_template(standard_itype_ids[entnum]); std::string padding = std::string(menu->pad_right - 1, ' '); for(int i = 0; i < lastlen + starty + 1; i++ ) { mvwprintw(menu->window, 1 + i, startx, "%s", padding.c_str() ); } if ( ity != NULL ) { tmp.make(item_controller->find_template(standard_itype_ids[entnum])); tmp.bday = g->turn; if (tmp.is_tool()) { tmp.charges = dynamic_cast<it_tool *>(tmp.type)->max_charges; } else if (tmp.is_ammo()) { tmp.charges = 100; } else if (tmp.is_gun()) { tmp.charges = 0; } else if (tmp.is_gunmod() && (tmp.has_flag("MODE_AUX") || tmp.typeId() == "spare_mag")) { tmp.charges = 0; } else { tmp.charges = -1; } if( tmp.is_stationary() ) { tmp.note = SNIPPET.assign( (dynamic_cast<it_stationary *>(tmp.type))->category ); } std::vector<std::string> desc = foldstring(tmp.info(true), menu->pad_right - 1); int dsize = desc.size(); if ( dsize > menu->w_height - 5 ) { dsize = menu->w_height - 5; } lastlen = dsize; std::string header = string_format("#%d: %s%s", entnum, standard_itype_ids[entnum].c_str(), ( incontainer ? " (contained)" : "" ) ); mvwprintz(menu->window, 1, startx + ( menu->pad_right - 1 - header.size() ) / 2, c_cyan, "%s", header.c_str() ); for(int i = 0; i < desc.size(); i++ ) { mvwprintw(menu->window, starty + i, startx, "%s", desc[i].c_str() ); } mvwprintz(menu->window, menu->w_height - 3, startx, c_green, "%s", msg.c_str()); msg = padding; mvwprintw(menu->window, menu->w_height - 2, startx, "[/] find, [f] container, [q]uit"); } }