// // if both objName and pageName are provided, and this object has page info, // return true if object matches both string and location. // else just return true if object matches string // bool plNetObjectDebugger::DebugObject::ObjectMatches(const char* objName, const char* pageName) { if (!objName) return false; if (!pageName || (fFlags & kPageMatch)==0) { // only have enough info to match by objName return StringMatches(objName); } plLocation loc; loc = plKeyFinder::Instance().FindLocation(NetCommGetAge()->ageDatasetName, pageName); return (StringMatches(objName) && loc==fLoc); }
// // try to match by plLocation // bool plNetObjectDebugger::DebugObject::ObjectMatches(const hsKeyedObject* obj) { if (!obj || !obj->GetKey()) return false; if ((fFlags & kPageMatch)==0) { // match based on object name only return StringMatches(obj->GetKeyName().c_str()); } return (obj->GetKey()->GetUoid().GetLocation()==fLoc); }
bool BattleListFilter::FilterBattle(IBattle& battle) { if (!m_activ) return true; if (m_filter_highlighted->IsChecked() | m_filter_status_start->IsChecked() | m_filter_status_locked->IsChecked() | m_filter_status_pass->IsChecked() | m_filter_status_full->IsChecked() | m_filter_status_open->IsChecked()) { bool bResult = false; if (m_filter_highlighted->IsChecked()) { try { wxString host = TowxString(battle.GetFounder().GetNick()); bResult = useractions().DoActionOnUser(UserActions::ActHighlight, host); if (!bResult) for (unsigned int i = 0; i < battle.GetNumUsers(); ++i) { wxString name = TowxString(battle.GetUser(i).GetNick()); if (useractions().DoActionOnUser(UserActions::ActHighlight, name)) { bResult = true; break; } } } catch (...) { } } //Battle Status Check if (m_filter_status_start->GetValue()) bResult |= battle.GetInGame(); if (m_filter_status_locked->GetValue()) bResult |= battle.IsLocked(); if (m_filter_status_pass->GetValue()) bResult |= battle.IsPassworded(); if (m_filter_status_full->GetValue()) bResult |= battle.IsFull(); if (m_filter_status_open->GetValue()) bResult |= (!battle.IsPassworded() && !battle.IsLocked() && !battle.GetInGame() && !battle.IsFull()); if (bResult == false) return false; } //Rank Check /** @fixme Is `nonsenserank' useful, or can it be removed? Why is * it here in the first place? */ /* `Nonsense', in this context, apparently means that the battle * requires rank 100, exactly, AND we're filtering for values less * than some number. */ bool nonsenserank = (m_filter_rank_mode == BUTTON_MODE_SMALLER) && (battle.GetRankNeeded() == 100); if (m_filter_rank_choice_value != -1 /* don't have "all" selected */ && !nonsenserank /* Nonsensical `nonsenserank' flag isn't set. */ && !_IntCompare(battle.GetRankNeeded(), m_filter_rank_choice_value, m_filter_rank_mode)) return false; //Player Check if ((m_filter_player_choice_value != -1) && !_IntCompare(battle.GetNumUsers() - battle.GetSpectators(), m_filter_player_choice_value, m_filter_player_mode)) return false; //MaxPlayer Check if ((m_filter_maxplayer_choice_value != -1) && !_IntCompare(battle.GetMaxPlayers(), m_filter_maxplayer_choice_value, m_filter_maxplayer_mode)) return false; //Spectator Check if ((m_filter_spectator_choice_value != -1) && !_IntCompare(battle.GetSpectators(), m_filter_spectator_choice_value, m_filter_spectator_mode)) return false; //Only Maps i have Check if (m_filter_map_show->GetValue() && !battle.MapExists()) return false; //Only Mods i have Check if (m_filter_mod_show->GetValue() && !battle.GameExists()) return false; //Strings Plain Text & RegEx Check (Case insensitiv) //Description: if (!StringMatches(TowxString(battle.GetDescription()), m_filter_description_edit->GetValue(), m_filter_description_expression)) return false; //Host: try { //!TODO if (!StringMatches(TowxString(battle.GetFounder().GetNick()), m_filter_host_edit->GetValue(), m_filter_host_expression)) return false; } catch (...) { } //Map: if (!StringMatches(TowxString(battle.GetHostMapName()), m_filter_map_edit->GetValue(), m_filter_map_expression)) return false; //Mod: if (!StringMatches(TowxString(battle.GetHostGameName()), m_filter_mod_edit->GetValue(), m_filter_mod_expression)) return false; return true; }