item_list::item_list(const std::vector<item_t*>& items, item_list_action action) : m_action(action), m_page(0), m_examine_mode(false) { for (size_t i = 0; i < items.size(); i++) { item_t* item = items.at(i); if (item && valid_item(item)) { entry_t entry; entry.c = (int)'a' + i; entry.item = item; m_items.push_back(entry); } } m_action_name = action == DROP ? "Inventory - Drop" : action == READ ? "Inventory - Read a scroll" : action == QUAF ? "Inventory - Quaff a potion" : action == ZAP ? "Inventory - Zap a wand" : action == EQUIP ? "Inventory - Equip an item" : action == PICKUP ? "Items on ground" : action == IDENTIFY ?"Inventory - Identify item" : action == ENCHANT_WEAPON ? "Inventory - Enchant weapon" : action == ENCHANT_ARMOR ? "Inventory - Enchant armor" : action == EAT ? "Inventory - Eat food" : "Inventory"; }
int Shop::ShopItem::adjusted_price() const { int p = price_; if (increase_price_with_illegality_ && itemclass_ == WEAPON && valid_item()) { for (int i = weapontype[getweapontype(itemtypename_)]->get_legality(); i < law[LAW_GUNCONTROL]; ++i) { p *= 2; } } return p; }
void Track_station_now(Widget w, XtPointer clientData, XtPointer callData) { char temp[MAX_CALLSIGN+1]; char temp2[200]; int found = 0; char *temp_ptr; temp_ptr = XmTextFieldGetString(track_station_data); xastir_snprintf(temp, sizeof(temp), "%s", temp_ptr); XtFree(temp_ptr); (void)remove_trailing_spaces(temp); (void)remove_trailing_dash_zero(temp); xastir_snprintf(tracking_station_call, sizeof(tracking_station_call), "%s", temp); track_case = (int)XmToggleButtonGetState(track_case_data); track_match = (int)XmToggleButtonGetState(track_match_data); found = locate_station(da, temp, track_case, track_match, 0); if ( valid_object(tracking_station_call) // Name of object is legal || valid_call(tracking_station_call) || valid_item(tracking_station_call ) ) { track_station_on = 1; // Track it whether we've seen it yet or not if (!found) { xastir_snprintf(temp2, sizeof(temp2), langcode("POPEM00026"), temp); popup_message_always(langcode("POPEM00025"),temp2); } // Check for exact match, includes SSID if ( track_me & !is_my_call( tracking_station_call, 1) ) { XmToggleButtonSetState( trackme_button, FALSE, FALSE ); track_me = 0; } } else { tracking_station_call[0] = '\0'; // Empty it out again track_station_on = 0; xastir_snprintf(temp2, sizeof(temp2), langcode("POPEM00002"), temp); popup_message_always(langcode("POPEM00003"),temp2); } track_station_destroy_shell(w, clientData, callData); display_zoom_status(); }
bool Shop::ShopItem::display() const { return (valid_item() && (!only_sell_legal_ || legal())); }
bool Shop::ShopItem::is_available() const { return valid_item() && (!only_sell_legal_ || legal()) && can_afford(); }