这篇教程C++ I2A函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中I2A函数的典型用法代码示例。如果您正苦于以下问题:C++ I2A函数的具体用法?C++ I2A怎么用?C++ I2A使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了I2A函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: view_spec_menu/** * Display list available specialties. */void view_spec_menu(void){ menu_type menu; menu_iter menu_f = { view_spec_tag, 0, view_spec_display, 0, 0 }; region loc = { 0, 0, 70, -99 }; char buf[80]; /* Save the screen and clear it */ screen_save(); /* Prompt choices */ sprintf(buf, "Race, class, and specialties abilities (%c-%c, ESC=exit): ", I2A(0), I2A(spec_known - 1)); /* Set up the menu */ menu_init(&menu, MN_SKIN_SCROLL, &menu_f); menu.header = buf; menu_setpriv(&menu, spec_known, spec_list); loc.page_rows = spec_known + 1; menu.flags = MN_DBL_TAP; menu.browse_hook = view_spec_menu_browser; region_erase_bordered(&loc); menu_layout(&menu, &loc); menu_select(&menu, 0); /* Load screen */ screen_load(); return;}
开发者ID:artes-liberales,项目名称:FAangband,代码行数:34,
示例2: _list_spellsstatic void _list_spells(doc_ptr doc, int options){ int i; doc_insert(doc, "<style:table>"); doc_printf(doc, "<color:G> %-20.20s Lvl SP Fail %-15.15s", "Name", "Desc"); if (options & _SHOW_STATS) doc_insert(doc, " Cast Fail"); doc_insert(doc, "</color>/n"); for (i = 0; i < _MAX_SLOTS; i++) { if (_spells[i].realm != REALM_NONE) _list_spell(doc, _spells[i].realm, _spells[i].spell, i, options); else { if (options & _ALLOW_EMPTY) doc_printf(doc, " %c) <color:D>(Empty)</color>/n", I2A(i)); else doc_printf(doc, " <color:D>%c) (Empty)</color>/n", I2A(i)); } } doc_insert(doc, "</style>"); if (_browse_choice != -1 && _spells[_browse_choice].realm != REALM_NONE) { doc_newline(doc); doc_printf(doc, " <indent>%s</indent>/n/n", do_spell(_spells[_browse_choice].realm, _spells[_browse_choice].spell, SPELL_DESC)); }}
开发者ID:poschengband,项目名称:poschengband,代码行数:31,
示例3: gear_to_label/** * Convert a gear object into a one character label. */char gear_to_label(struct object *obj){ int i; /* Equipment is easy */ if (object_is_equipped(player->body, obj)) { return I2A(equipped_item_slot(player->body, obj)); } /* Check the quiver */ for (i = 0; i < z_info->quiver_size; i++) { if (player->upkeep->quiver[i] == obj) { return I2D(i); } } /* Check the inventory */ for (i = 0; i < z_info->pack_size; i++) { if (player->upkeep->inven[i] == obj) { return I2A(i); } } return '/0';}
开发者ID:NickMcConnell,项目名称:angband,代码行数:28,
示例4: _choose_mimic_formstatic int _choose_mimic_form(void){ int r_idx = -1; int i; _choice_array_t choices = {{{0}}}; /* List Known Forms */ for (i = 0; i < _MAX_FORMS; i++) { if (_forms[i]) { int j = choices.size++; _choice_t *choice = &choices.choices[j]; choice->r_idx = _forms[i]; choice->slot = i; choice->type = _TYPE_KNOWN; choice->key = I2A(j); } } /* List Visible Forms */ for (i = 1; i < m_max; i++) { monster_type *m_ptr = &m_list[i]; if (!m_ptr->r_idx) continue; if (!m_ptr->ml) continue; if (!projectable(py, px, m_ptr->fy, m_ptr->fx)) continue; if (!r_info[m_ptr->r_idx].body.life) continue; /* Form not implemented yet ... */ _add_visible_form(&choices, m_ptr->r_idx); } /* Assign menu keys at the end due to insertion sort */ for (i = 0; i < choices.size; i++) { _choice_t *choice = &choices.choices[i]; if (choice->type == _TYPE_VISIBLE) choice->key = I2A(i); } if (choices.size) { choices.mode = _CHOOSE_MODE_MIMIC; if (_choose(&choices)) r_idx = choices.choices[choices.current].r_idx; do_cmd_redraw(); } else msg_print("You see nothing to mimic."); return r_idx;}
开发者ID:bamhamcity,项目名称:lessxpcb,代码行数:54,
示例5: _list_spellstatic void _list_spell(doc_ptr doc, int realm, int spell, int choice, int options){ magic_type *spell_ptr = _get_spell_info(realm, spell); int cost = calculate_cost(spell_ptr->smana); int fail = calculate_fail_rate(spell_ptr->slevel, spell_ptr->sfail, p_ptr->stat_ind[A_INT]); if (cost > p_ptr->csp) doc_insert(doc, "<color:D>"); else if (choice == _browse_choice) doc_insert(doc, "<color:B>"); else if (spell_ptr->slevel > p_ptr->lev) { if (options & _FROM_BOOK) doc_insert(doc, "<color:D>"); else doc_insert(doc, "<color:y>"); } else doc_insert(doc, "<color:w>"); if (spell_ptr->slevel > p_ptr->lev) doc_printf(doc, " <color:D>%c)</color> ", I2A(choice)); else doc_printf(doc, " %c) ", I2A(choice)); doc_printf(doc, "%-20.20s ", do_spell(realm, spell, SPELL_NAME)); doc_printf(doc, "%3d %3d %3d%% ", spell_ptr->slevel, cost, fail); if (spell_ptr->slevel > p_ptr->lev) { if (options & _FROM_BOOK) doc_printf(doc, "%-15.15s", ""); else doc_printf(doc, "%-15.15s", "Forgotten"); } else if (options & _SHOW_INFO) doc_printf(doc, "%-15.15s", do_spell(realm, spell, SPELL_INFO)); if (options & _SHOW_STATS) { spell_stats_ptr stats = spell_stats_old(realm, spell); if (stats->ct_cast + stats->ct_fail) { doc_printf(doc, " %5d %4d %3d%%", stats->ct_cast, stats->ct_fail, spell_stats_fail(stats) ); } } doc_insert(doc, "</color>/n");}
开发者ID:poschengband,项目名称:poschengband,代码行数:53,
示例6: melee_effect_handler_EAT_FOOD/** * Melee effect handler: Eat the player's food. */static void melee_effect_handler_EAT_FOOD(melee_effect_handler_context_t *context){ /* Steal some food */ int tries; /* Take damage */ take_hit(context->p, context->damage, context->ddesc); /* Player is dead */ if (context->p->is_dead) return; for (tries = 0; tries < 10; tries++) { /* Pick an item from the pack */ int index = randint0(z_info->pack_size); struct object *obj, *eaten; char o_name[80]; bool none_left = false; /* Get the item */ obj = context->p->upkeep->inven[index]; /* Skip non-objects */ if (obj == NULL) continue; /* Skip non-food objects */ if (!tval_is_edible(obj)) continue; if (obj->number == 1) { object_desc(o_name, sizeof(o_name), obj, ODESC_BASE); msg("Your %s (%c) was eaten!", o_name, I2A(index)); } else { object_desc(o_name, sizeof(o_name), obj, ODESC_PREFIX | ODESC_BASE); msg("One of your %s (%c) was eaten!", o_name, I2A(index)); } /* Steal and eat */ eaten = gear_object_for_use(obj, 1, false, &none_left); if (eaten->known) object_delete(&eaten->known); object_delete(&eaten); /* Obvious */ context->obvious = true; /* Done */ break; }}
开发者ID:BardurArantsson,项目名称:angband,代码行数:54,
示例7: pack_overflow/** * Overflow an item from the pack, if it is overfull. */void pack_overflow(void){ int i; struct object *obj = NULL; char o_name[80]; if (!pack_is_overfull()) return; /* Disturbing */ disturb(player, 0); /* Warning */ msg("Your pack overflows!"); /* Find the last inventory item */ for (i = 1; i <= z_info->pack_size; i++) if (!player->upkeep->inven[i]) break; /* Last object was the previous index */ obj = player->upkeep->inven[i - 1]; /* Rule out weirdness (like pack full, but inventory empty) */ assert(obj != NULL); /* Describe */ object_desc(o_name, sizeof(o_name), obj, ODESC_PREFIX | ODESC_FULL); /* Message */ msg("You drop %s (%c).", o_name, I2A(i - 1)); /* Excise the object and drop it (carefully) near the player */ gear_excise_object(obj); drop_near(cave, obj, 0, player->py, player->px, FALSE); /* Describe */ if (obj->artifact) msg("You no longer have the %s (%c).", o_name, I2A(i - 1)); else msg("You no longer have %s (%c).", o_name, I2A(i - 1)); /* Notice stuff (if needed) */ if (player->upkeep->notice) notice_stuff(player->upkeep); /* Update stuff (if needed) */ if (player->upkeep->update) update_stuff(player->upkeep); /* Redraw stuff (if needed) */ if (player->upkeep->redraw) redraw_stuff(player->upkeep);}
开发者ID:tingley,项目名称:angband,代码行数:53,
示例8: inven_takeoff/** * Take off a non-cursed equipment item * * Note that taking off an item when "full" may cause that item * to fall to the ground. * * Note also that this function does not try to combine the taken off item * with other inventory items - that must be done by the calling function. */void inven_takeoff(struct object *obj){ int slot = equipped_item_slot(player->body, obj); const char *act; char o_name[80]; /* Paranoia */ if (slot == player->body.count) return; /* Describe the object */ object_desc(o_name, sizeof(o_name), obj, ODESC_PREFIX | ODESC_FULL); /* Describe removal by slot */ if (slot_type_is(slot, EQUIP_WEAPON)) act = "You were wielding"; else if (slot_type_is(slot, EQUIP_BOW)) act = "You were holding"; else if (slot_type_is(slot, EQUIP_LIGHT)) act = "You were holding"; else act = "You were wearing"; /* De-equip the object */ player->body.slots[slot].obj = NULL; player->upkeep->equip_cnt--; /* Message */ msgt(MSG_WIELD, "%s %s (%c).", act, o_name, I2A(slot)); player->upkeep->update |= (PU_BONUS | PU_INVEN); player->upkeep->notice |= (PN_IGNORE); return;}
开发者ID:fe051,项目名称:angband,代码行数:42,
示例9: borg_think_shop_buy/* * Buy items from the current shop */static void borg_think_shop_buy(int item){ list_item *l_ptr = &cur_list[item]; /* Is the borg on page 1 but wants to be one page 2? */ if ((borg_term_text_comp(26, 5, "1") && item >= STORE_INVEN_MAX / 2) || (borg_term_text_comp(26, 5, "2") && item < STORE_INVEN_MAX / 2)) { /* Goto the other page */ borg_keypress(' '); } /* Log */ borg_note("# Buying %s (%i gold).", l_ptr->o_name, l_ptr->cost); /* Buy one item */ borg_keypress('0'); borg_keypress('1'); /* Buy an item */ borg_keypress('p'); /* Buy the desired item */ borg_keypress(I2A(item % (STORE_INVEN_MAX / 2))); /* Increment 'use' count */ borg_shops[shop_num].u_count++; /* The purchase is complete */ goal_shop = -1;}
开发者ID:jcheatham,项目名称:Zangband,代码行数:34,
示例10: altel6045_get_dt_dataint altel6045_get_dt_data(const hwextisp_intf_t *i, struct device_node *of_node){ int ret = 0; int index = 0; altek6045_private_data_t* pdata = NULL; altek6045_t* mini_isp = NULL; mini_isp = I2A(i); pdata = (altek6045_private_data_t *)mini_isp->pdata; ret = of_property_read_u32_array(of_node, "hisi,isp-pin", pdata->pin, ISP_MAX); if (ret < 0) { cam_err("%s failed line %d/n", __func__, __LINE__); return ret; } else { for (index = 0; index < ISP_MAX; index++) { cam_debug("%s pin[%d]=%d./n", __func__, index, pdata->pin[index]); } }#if 0 ret = gpio_request(pdata->pin[ISP_DVDD], "isp-dcdc"); if (ret < 0) { cam_err("%s failed to request isp-dvdd pin.", __func__); return ret; }#endif return ret; }
开发者ID:herryfan,项目名称:kernel-huawei-h60,代码行数:30,
|