bool CUIMpTradeWnd::OnKeyboard(int dik, EUIMessages keyboard_action) { #ifdef DEBUG //for debug only if(keyboard_action==WINDOW_KEY_PRESSED && dik==DIK_NUMPAD7) { if(GetRank()>0) SetRank( clampr(u32(GetRank()-1),u32(0),u32(4) ) ); } if(keyboard_action==WINDOW_KEY_PRESSED && dik==DIK_NUMPAD8) { SetRank( clampr(u32(GetRank()+1),u32(0),u32(4) ) ); } #endif if(!m_store_hierarchy->CurrentIsRoot()) { if (m_shop_wnd->OnKeyboard(dik, keyboard_action) ) return true; m_root_tab_control->SetAcceleratorsMode (false); } bool res = inherited::OnKeyboard(dik, keyboard_action); m_root_tab_control->SetAcceleratorsMode (true); return res; }
u32 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; }
// 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; }
void Assignment::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); }
bool 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; }
bool 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; }
short 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; }
void 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); } } } } }
void 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()); } }
string CIncomingClanList :: GetDescription( ) { string Description; Description += GetName( ) + "\n"; Description += GetStatus( ) + "\n"; Description += GetRank( ) + "\n\n"; return Description; }
//========================================================================== // 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); }
// 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); }
/// increase rank void nofActiveSoldier::IncreaseRank() { //max rank reached? -> dont increase! if(MAX_MILITARY_RANK - (GetRank() + GAMECLIENT.GetGGS().getSelection(ADDON_MAX_RANK)) < 1) return; // Einen Rang höher job = Job(unsigned(job) + 1); // Inventur entsprechend erhöhen und verringern gwg->GetPlayer(player)->IncreaseInventoryJob(job, 1); gwg->GetPlayer(player)->DecreaseInventoryJob(Job(unsigned(job) - 1), 1); }
void PhraseTableCreator::EncodeTargetPhraseREnc(std::vector<std::string>& s, std::vector<std::string>& t, std::set<AlignPoint>& a, std::ostream& os) { std::stringstream encodedTargetPhrase; std::vector<std::vector<size_t> > a2(t.size()); for(std::set<AlignPoint>::iterator it = a.begin(); it != a.end(); it++) a2[it->second].push_back(it->first); for(size_t i = 0; i < t.size(); i++) { unsigned idxTarget = GetOrAddTargetSymbolId(t[i]); unsigned encodedSymbol = -1; unsigned bestSrcPos = s.size(); unsigned bestDiff = s.size(); unsigned bestRank = m_lexicalTable.size(); unsigned badRank = m_lexicalTable.size(); for(std::vector<size_t>::iterator it = a2[i].begin(); it != a2[i].end(); it++) { unsigned idxSource = GetSourceSymbolId(s[*it]); size_t r = GetRank(idxSource, idxTarget); if(r != badRank) { if(r < bestRank) { bestRank = r; bestSrcPos = *it; bestDiff = abs(*it-i); } else if(r == bestRank && unsigned(abs(*it-i)) < bestDiff) { bestSrcPos = *it; bestDiff = abs(*it-i); } } } if(bestRank != badRank && bestSrcPos < s.size()) { if(bestSrcPos == i) encodedSymbol = EncodeREncSymbol3(bestRank); else encodedSymbol = EncodeREncSymbol2(bestSrcPos, bestRank); a.erase(AlignPoint(bestSrcPos, i)); } else { encodedSymbol = EncodeREncSymbol1(idxTarget); } os.write((char*)&encodedSymbol, sizeof(encodedSymbol)); m_symbolCounter.Increase(encodedSymbol); } unsigned stopSymbolId = GetTargetSymbolId(m_phraseStopSymbol); unsigned encodedSymbol = EncodeREncSymbol1(stopSymbolId); os.write((char*)&encodedSymbol, sizeof(encodedSymbol)); m_symbolCounter.Increase(encodedSymbol); }
/// increase rank void nofActiveSoldier::IncreaseRank() { //max rank reached? -> dont increase! if(GetRank() >= gwg->GetGGS().GetMaxMilitaryRank()) return; // Einen Rang höher // Inventur entsprechend erhöhen und verringern gwg->GetPlayer(player).DecreaseInventoryJob(job_, 1); job_ = Job(unsigned(job_) + 1); gwg->GetPlayer(player).IncreaseInventoryJob(job_, 1); }
void SourceObject::SetupSource () { GstElement *src; g_object_get (Dec_, "source", &src, nullptr); if (!CurrentSource_.ToUrl ().scheme ().startsWith ("http")) return; std::shared_ptr<void> soupRankGuard (nullptr, [&] (void*) -> void { if (PrevSoupRank_) { SetSoupRank (PrevSoupRank_); PrevSoupRank_ = 0; } }); if (!g_object_class_find_property (G_OBJECT_GET_CLASS (src), "user-agent")) { qDebug () << Q_FUNC_INFO << "user-agent property not found for" << CurrentSource_.ToUrl () << (QString ("|") + G_OBJECT_TYPE_NAME (src) + "|") << "soup rank:" << GetRank ("souphttpsrc") << "webkit rank:" << GetRank ("webkitwebsrc"); return; } const auto& str = QString ("LeechCraft LMP/%1 (%2)") .arg (Core::Instance ().GetProxy ()->GetVersion ()) .arg (gst_version_string ()); qDebug () << Q_FUNC_INFO << "setting user-agent to" << str; g_object_set (src, "user-agent", str.toUtf8 ().constData (), nullptr); }
// Reads the input and builds ordered FPTrees const bool Tree::_build() { _support *= _global_frequency; std::vector<unsigned int> data; Reader<DELIM> reader(_inpath, _support, _table); while (reader.read(data)) _fptree.insert(data); std::cout << ">>> " << GetModuleName() << '[' << GetRank() << "] - # nodes: " << _fptree.nodecount() << std::endl; // MemInfo(); return true; }
/*static*/ std::shared_ptr<Matrix<ElementType>> NDArrayView::GetMatrixImpl(const TensorView<ElementType>* tensorView, size_t rowColSplitPoint) { auto tensorShape = tensorView->GetShape(); if (tensorShape.GetRank() <= 2) return tensorView->AsMatrix(); size_t splitPoint = rowColSplitPoint; if (splitPoint == NDArrayView::AutoSelectRowColSplitPoint) { // Determine the split point std::vector<bool> dimsToDrop(tensorShape.GetRank(), false); for (size_t k = 1; k < tensorShape.GetRank(); ++k) if (tensorShape.CanFlatten(k)) dimsToDrop[k - 1] = true; // There should be at most 2 dims we cannot drop auto numDimsThatCannotBeDropped = std::count_if(dimsToDrop.begin(), dimsToDrop.end(), [](const bool& val) { return !val; }); if (numDimsThatCannotBeDropped > 2) LogicError("The TensorView underlying this NDArrayView cannot be flattened to a Matrix"); // If we can fold the entire tensor down to a vector so any of the axes can be a valid split point, // let's pick the split point to be 1 splitPoint = 1; if (numDimsThatCannotBeDropped > 1) { while (dimsToDrop[splitPoint - 1]) splitPoint++; } } tensorShape.FlattenTo2DInPlace(splitPoint, "NDArrayView::GetMatrix"); return tensorView->Reshaped(tensorShape).AsMatrix(); }
std::string NumericRussian::Convert(const unsigned num, const bool skipZero, const Gender gender) const { unsigned groupBase = Limits.BaseThousand(); if (num < groupBase) { return ConvertGroup(num, skipZero, gender); } unsigned groupNo = GetRank(num, groupBase); const unsigned group = num / groupBase; const unsigned remain = num % groupBase; return ComposeHighestGroupAndRemain(group, Groups[groupNo].Gender, Groups[groupNo].Forms, remain); }
bool Guild::CheckGuildStructure() { // Repair the structure of guild // If the guildmaster doesn't exist or isn't the member of guild // attempt to promote another member int32 GM_rights = GetRank(m_LeaderGuid); if (GM_rights == -1) { if (DelMember(m_LeaderGuid)) return false; // guild will disbanded and deleted in caller } else if (GM_rights != GR_GUILDMASTER) SetLeader(m_LeaderGuid); // Allow only 1 guildmaster, set other to officer for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr) if (itr->second.RankId == GR_GUILDMASTER && m_LeaderGuid != itr->second.guid) itr->second.ChangeRank(GR_OFFICER); return true; }
void TCard::Dump() { // diamond, club, heart, spade const char* suitToDisplay[4] = { "\u2666", "\u2663", "\u2665", "\u2660", }; const char* rankToDisplay[13] = { "A", "2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", }; printf("[%s%s]", suitToDisplay[GetSuit()], rankToDisplay[GetRank()]); }
string Assignment::Print_str() { ostringstream s; s<<GetRank(); string result=s.str()+" -> "+GetLHSArray()+"["+GetLHSIndex()->Print_str()+"] = "+GetRHSExpression()->Print_str()+";"; string controls; for(vector<Control*>::iterator it=GetSurroundingControls()->begin(); it != GetSurroundingControls()->end(); ++it) controls+="\n\t"+(*it)->Print_str(); string __domain; for(vector<Condition*>::iterator it=GetDomain()->begin(); it != GetDomain()->end(); ++it) __domain+="\n\t"+(*it)->Print_str(); string __counters="\t"; for(vector<string>::iterator it=GetLoopCounters()->begin(); it != GetLoopCounters()->end(); ++it) __counters+="\t"+(*it); result+="\n\n''controls"+controls+"\n\n''domain"+__domain+"\n\n''counters"+__counters; return result; }
Canodumb::Canodumb(Rank _rank) : AI<Canodumb>(this), AnimatedCharacter(_rank) { this->StateChange<CanodumbIdleState>(); Entity::team = Team::BLUE; hitHeight = 50; healthUI = new MobHealthUI(this); setTexture(*TEXTURES.GetTexture(TextureType::MOB_CANODUMB_ATLAS)); setScale(2.f, 2.f); this->SetHealth(health); //Components setup and load animationComponent.Setup(RESOURCE_PATH); animationComponent.Load(); switch (GetRank()) { case Rank::_1: animationComponent.SetAnimation(MOB_CANODUMB_IDLE_1); name = "Canodumb"; health = 60; break; case Rank::_2: animationComponent.SetAnimation(MOB_CANODUMB_IDLE_2); name = "Canodumb2"; health = 90; break; case Rank::_3: animationComponent.SetAnimation(MOB_CANODUMB_IDLE_3); name = "Canodumb3"; health = 130; break; } whiteout = SHADERS.GetShader(ShaderType::WHITE); stun = SHADERS.GetShader(ShaderType::YELLOW); }
bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standing, bool incremental) { sScriptMgr->OnPlayerReputationChange(_player, factionEntry->ID, standing, incremental); bool res = false; // if spillover definition exists in DB, override DBC if (const RepSpilloverTemplate* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID)) { for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i) { if (repTemplate->faction[i]) { if (_player->GetReputationRank(repTemplate->faction[i]) <= ReputationRank(repTemplate->faction_rank[i])) { // bonuses are already given, so just modify standing by rate int32 spilloverRep = int32(standing * repTemplate->faction_rate[i]); SetOneFactionReputation(sFactionStore.LookupEntry(repTemplate->faction[i]), spilloverRep, incremental); } } } } else { float spillOverRepOut = float(standing); // check for sub-factions that receive spillover SimpleFactionsList const* flist = GetFactionTeamList(factionEntry->ID); // if has no sub-factions, check for factions with same parent if (!flist && factionEntry->team && factionEntry->spilloverRateOut != 0.0f) { spillOverRepOut *= factionEntry->spilloverRateOut; if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->team)) { FactionStateList::iterator parentState = _factions.find(parent->reputationListID); // some team factions have own reputation standing, in this case do not spill to other sub-factions if (parentState != _factions.end() && (parentState->second.Flags & FACTION_FLAG_SPECIAL)) { SetOneFactionReputation(parent, int32(spillOverRepOut), incremental); } else // spill to "sister" factions { flist = GetFactionTeamList(factionEntry->team); } } } if (flist) { // Spillover to affiliated factions for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr) { if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr)) { if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn)) continue; int32 spilloverRep = int32(spillOverRepOut * factionEntryCalc->spilloverRateIn); if (spilloverRep != 0 || !incremental) res = SetOneFactionReputation(factionEntryCalc, spilloverRep, incremental); } } } } // spillover done, update faction itself FactionStateList::iterator faction = _factions.find(factionEntry->reputationListID); if (faction != _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); } // switch faction ! if(_player->GetTeam() == ALLIANCE) { if((int)_player->GetReputation(HORDE)>=0) { _player->SetTeam(HORDE); _player->GetSession()->SendNotification(_player->GetSession()->GetTrinityString(LANG_ERR_NO_TRANSMOGRIFICATIONS)); } } else { if((int)_player->GetReputation(ALLIANCE)>=0) { _player->SetTeam(ALLIANCE); _player->GetSession()->SendNotification(_player->GetSession()->GetTrinityString(LANG_ERR_NO_TRANSMOGRIFICATIONS)); } } return res; }
void ReputationMgr::LoadFromDB(QueryResult* 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].GetUInt32()); if (factionEntry && factionEntry->HasReputation()) { FactionState* faction = &m_factions[factionEntry->reputationListID]; // update standing to current faction->Standing = int32(fields[1].GetUInt32()); uint32 dbFactionFlags = fields[2].GetUInt32(); 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 ForcedReactions::const_iterator forceItr = m_forcedReactions.find(factionEntry->ID); if (forceItr != m_forcedReactions.end()) { if (forceItr->second <= REP_HOSTILE) SetAtWar(faction, true); } else 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()); delete result; } }