这篇教程C++ GetRank函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetRank函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRank函数的具体用法?C++ GetRank怎么用?C++ GetRank使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetRank函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetPresetu32 CUIMpTradeWnd::GetPresetCost(ETradePreset idx){ const preset_items& v = GetPreset(idx); preset_items::const_iterator it = v.begin(); preset_items::const_iterator it_e = v.end(); u32 result = 0; for(;it!=it_e;++it) { const _preset_item& _one = *it; u32 _item_cost = m_item_mngr->GetItemCost(_one.sect_name, GetRank() ); if(_one.addon_names[0].c_str()) _item_cost += m_item_mngr->GetItemCost(_one.addon_names[0], GetRank() ); if(_one.addon_names[1].c_str()) _item_cost += m_item_mngr->GetItemCost(_one.addon_names[1], GetRank() ); if(_one.addon_names[2].c_str()) _item_cost += m_item_mngr->GetItemCost(_one.addon_names[2], GetRank() ); _item_cost *= _one.count; result += _item_cost; } return result;}
开发者ID:2asoft,项目名称:xray,代码行数:28,
示例2: assert// initial condition: out must have all its header fields filled in (gen, num_blocks_gen, block_size)bool NC::ReEncodeBlock(std::vector<CodedBlockPtr> &buffer, CodedBlock *out) { assert( out != NULL); int i, j; int gen = out->gen; int num_blocks_gen = out->num_blocks_gen; int block_size = out->block_size; /* if( !buffer[gen].size() ) return; */ if (!GetRank(&buffer)) return false; memset(out->coeffs, 0, num_blocks_gen); memset(out->sums, 0, (is_sim ? 1 : block_size)); unsigned char *randCoeffs = new unsigned char[num_blocks_gen]; // generate randomized coefficients // coefficients are drawn uniform randomly from {1, ..., 2^fsize} int field_limit = (int) 1 << (int) field_size;#ifdef WIN32 srand((unsigned int)GetTickCount());#else srand(time(NULL));#endif for (i = 0; i < GetRank(&buffer); ++i) while (!(randCoeffs[i] = (unsigned char) (rand() % field_limit))) ; // generate a coded piece from a set of coded pieces. { c_0, ... c_{GetRank()-1} } // c_i = {COEFFs, SUMs(i.e., coded symbols)} in the buffer (coded piece buffer in NC) // re-encoded piece = a_0*c_0 + a_1*c_1 + ... + a_{GetRank()-1}*c_{GetRank()-1} // where a_0, a_1, ..., a_{GetRank()} are random coefficients in randCoeffs[i] for (i = 0; i < GetRank(&buffer); ++i) { for (j = 0; j < num_blocks_gen; ++j) { out->coeffs[j] = gf->Add(gf->Mul(buffer[i]->coeffs[j], randCoeffs[i], field_size), out->coeffs[j], field_size); } for (j = 0; j < (is_sim ? 1 : block_size); ++j) { out->sums[j] = gf->Add(gf->Mul(buffer[i]->sums[j], randCoeffs[i], field_size), out->sums[j], field_size); } } delete[] randCoeffs; return true;}
开发者ID:uclanrl,项目名称:codetorrent,代码行数:59,
示例3: CollectReferencesvoidAssignment::Prepare(void){CollectReferences( ); //collect the referenced entities vector<Control*>::iterator it=GetSurroundingControls( )->begin();Condition* domain=new Condition(new Inequation(true));while(it != GetSurroundingControls( )->end()) { Control* st; if((*it)->IsLoop()) AddCounter( (*it)->GetLoopCounter()); Condition* __st_domain=(*it)->GetDomainConstraints(GetRank()); domain= new Condition(domain,FADA_AND, __st_domain); ++it; }Condition* __no_not= domain->EliminateNotOperations();Condition* __dnform= __no_not->DNForm();vector<Condition*>* new_domain=new vector<Condition*>();*new_domain=__dnform->GetTerms();SetDomain(new_domain);}
开发者ID:mbelaoucha,项目名称:fadalib,代码行数:28,
示例4: BackSubstitutionbool NC::BackSubstitution(std::vector<CodedBlockPtr> buffer, unsigned char **m_upper, unsigned char **m_data) { unsigned char tmp; int i, j, k; int num_blocks_gen = buffer[0]->num_blocks_gen; int block_size = buffer[0]->block_size; if (GetRank(&buffer) != num_blocks_gen) //check the GetRank() func parameter return false; for (i = num_blocks_gen - 1; i >= 0; i--) { for (j = 0; j < (is_sim ? 1 : block_size); j++) { tmp = (unsigned char) 0x0; for (k = i + 1; k < num_blocks_gen; k++) { tmp = gf->Add(tmp, gf->Mul(m_upper[i][k], m_data[k][j], field_size), field_size); } m_data[i][j] = gf->Div(gf->Sub(m_upper[i][num_blocks_gen + j], tmp, field_size), m_upper[i][i], field_size); } } return true;}
开发者ID:uclanrl,项目名称:codetorrent,代码行数:28,
示例5: SetReputationbool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental){ // used by eluna sHookMgr->OnReputationChange(m_player, factionEntry->ID, standing, incremental); bool res = false; // if spillover definition exists in DB if (const RepSpilloverTemplate *repTemplate = sObjectMgr.GetRepSpilloverTemplate(factionEntry->ID)) { for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i) { if (repTemplate->faction[i]) { if (GetRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i])) { // bonuses are already given, so just modify standing by rate int32 spilloverRep = standing * repTemplate->faction_rate[i]; SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental); } } } } // spillover done, update faction itself FactionStateList::iterator faction = m_factions.find(factionEntry->reputationListID); if (faction != m_factions.end()) { res = SetOneFactionReputation(factionEntry, standing, incremental); // only this faction gets reported to client, even if it has no own visible standing SendState(&faction->second); } return res;}
开发者ID:Blumfield,项目名称:ptc2,代码行数:34,
示例6: GetRankshort unsigned FiveEval::GetRank(int const card_one, const int card_two, const int card_three, const int card_four, const int card_five, const int card_six, const int card_seven) const { int seven_cards[7] = {card_one, card_two, card_three, card_four, card_five, card_six, card_seven}; int temp[5]; short unsigned best_rank_so_far = 0, current_rank = 0; int m = 0; for (int i = 1; i < 7; ++i) { for (int j = 0; j < i; ++j) { m = 0; for (int k = 0; k < 7; ++k) { if (k != i && k !=j) { temp[m++] = seven_cards[k]; } } current_rank = GetRank(temp[0], temp[1], temp[2], temp[3], temp[4]); if (best_rank_so_far < current_rank) { best_rank_so_far = current_rank; } } } return best_rank_so_far;}
开发者ID:4rapid,项目名称:SpecialKEval,代码行数:27,
示例7: DetachAddonvoid CUIMpTradeWnd::SellItemAddons(SBuyItemInfo* sell_itm, item_addon_type addon_type){ CInventoryItem* item_ = (CInventoryItem*)sell_itm->m_cell_item->m_pData; CWeapon* w = smart_cast<CWeapon*>(item_); if(!w) return; //ammo,medkit etc. if(IsAddonAttached(sell_itm, addon_type)) { SBuyItemInfo* detached_addon = DetachAddon(sell_itm, addon_type); u32 _item_cost = m_item_mngr->GetItemCost(detached_addon->m_name_sect, GetRank() ); SetMoneyAmount (GetMoneyAmount() + _item_cost); DestroyItem (detached_addon); if ( addon_type == at_glauncher ) { CWeaponMagazinedWGrenade* wpn2 = smart_cast<CWeaponMagazinedWGrenade*>(item_); VERIFY(wpn2); for ( u32 ammo_idx = 0; ammo_idx < wpn2->m_ammoTypes2.size(); ++ammo_idx ) { const shared_str& ammo_name = wpn2->m_ammoTypes2[ammo_idx]; SBuyItemInfo* ammo = NULL; while ( (ammo = FindItem(ammo_name, SBuyItemInfo::e_bought)) != NULL ) { SBuyItemInfo* tempo = NULL; TryToSellItem(ammo, true, tempo); } } } }}
开发者ID:2asoft,项目名称:xray,代码行数:34,
示例8: Initializevoid ReputationMgr::LoadFromDB(PreparedQueryResult result){ // Set initial reputations (so everything is nifty before DB data load) Initialize(); //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUIDLow()); if (result) { do { Field* fields = result->Fetch(); FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16()); if (factionEntry && (factionEntry->reputationListID >= 0)) { FactionState* faction = &_factions[factionEntry->reputationListID]; // update standing to current faction->Standing = fields[1].GetInt32(); // update counters int32 BaseRep = GetBaseReputation(factionEntry); ReputationRank old_rank = ReputationToRank(BaseRep); ReputationRank new_rank = ReputationToRank(BaseRep + faction->Standing); UpdateRankCounters(old_rank, new_rank); uint32 dbFactionFlags = fields[2].GetUInt16(); if (dbFactionFlags & FACTION_FLAG_VISIBLE) SetVisible(faction); // have internal checks for forced invisibility if (dbFactionFlags & FACTION_FLAG_INACTIVE) SetInactive(faction, true); // have internal checks for visibility requirement if (dbFactionFlags & FACTION_FLAG_AT_WAR) // DB at war SetAtWar(faction, true); // have internal checks for FACTION_FLAG_PEACE_FORCED else // DB not at war { // allow remove if visible (and then not FACTION_FLAG_INVISIBLE_FORCED or FACTION_FLAG_HIDDEN) if (faction->Flags & FACTION_FLAG_VISIBLE) SetAtWar(faction, false); // have internal checks for FACTION_FLAG_PEACE_FORCED } // set atWar for hostile if (GetRank(factionEntry) <= REP_HOSTILE) SetAtWar(faction, true); // reset changed flag if values similar to saved in DB if (faction->Flags == dbFactionFlags) { faction->needSend = false; faction->needSave = false; } } } while (result->NextRow()); }}
开发者ID:Hlkz2,项目名称:ACoreOld,代码行数:59,
示例9: GetDescriptionstring CIncomingClanList :: GetDescription( ){ string Description; Description += GetName( ) + "/n"; Description += GetStatus( ) + "/n"; Description += GetRank( ) + "/n/n"; return Description;}
开发者ID:RiseCakoPlusplus,项目名称:brtGHost,代码行数:8,
示例10: GetInverse//==========================================================================// Class: Matrix// Function: GetInverse//// Description: Returns the inverse of this matrix. If this matrix is badly// scaled or is rectangular, the psuedo-inverse is returned.//// Input Arguments:// None//// Output Arguments:// inverse = Matrix&//// Return Value:// bool, true for success, false otherwise////==========================================================================bool Matrix::GetInverse(Matrix &inverse) const{ if (!IsSquare() || GetRank() != rows) return GetPsuedoInverse(inverse); // Don't see a point to having two inverse methods -> always use the same method return GetPsuedoInverse(inverse);}
开发者ID:KerryL,项目名称:RPiSousVide,代码行数:25,
示例11: GetRank// find the indices of the lattice element that contanis (x,y,z) int Lattice::GetIndices(float x, float y, float z, int &iidx, int &jidx, int &kidx) { int rank = GetRank(x,y,z); if (rank!=-1) { GetIndices(rank, iidx, jidx, kidx); return(rank); } else return(-1); }
开发者ID:recheliu,项目名称:FlowEntropy,代码行数:11,
示例12: IncreaseRank/// increase rankvoid nofActiveSoldier::IncreaseRank(){ //max rank reached? -> dont increase! if(MAX_MILITARY_RANK - (GetRank() + GAMECLIENT.GetGGS().getSelection(ADDON_MAX_RANK)) < 1) return; // Einen Rang h C++ GetRating函数代码示例 C++ GetRandom函数代码示例
|