void NickListCtrl::SetTipWindowText( const long item_hit, const wxPoint& position ) { int column = getColumnFromPosition( position ); if ( column > ( int )m_colinfovec.size() || column < 0 || item_hit < 0 || item_hit > ( long ) m_data.size() || m_data[item_hit] == NULL ) { m_tiptext = wxEmptyString; } else { const User& user = *m_data[item_hit]; { switch ( column ) { case 0: // status m_tiptext = _T( "This " ); if ( user.GetStatus().bot ) m_tiptext << _T( "bot " ); else if ( user.GetStatus().moderator ) m_tiptext << _T( "moderator " ); else m_tiptext << _T( "player " ); if ( user.GetStatus().in_game ) m_tiptext << _T( "is ingame" ); else if ( user.GetStatus().away ) m_tiptext << _T( "is away" ); else m_tiptext << _T( "is available" ); break; case 1: // country m_tiptext = GetFlagNameFromCountryCode( user.GetCountry().Upper() ); break; case 2: // rank m_tiptext = user.GetRankName( user.GetStatus().rank ); break; case 3: // nickname m_tiptext = user.GetNick(); break; default: m_tiptext = m_colinfovec[column].tip; break; } } } }
void BattleroomListCtrl::SetTipWindowText( const long item_hit, const wxPoint& position) { if ( item_hit < 0 || item_hit >= (long)m_data.size() ) return; if ( !m_battle ) return; const User& user = *GetDataFromIndex( item_hit ); int column = getColumnFromPosition( position ); if (column > (int)m_colinfovec.size() || column < 0) { m_tiptext = _T(""); } else { if ( column == m_status_column_index ) // is bot? { m_tiptext = _T(""); if ( user.BattleStatus().IsBot() ) { m_tiptext += _("AI (bot)\n"); } else { m_tiptext += _("Human\n"); } if ( user.BattleStatus().spectator ) { m_tiptext += _("Spectator\n"); } else { m_tiptext += _("Player\n"); } if ( m_battle->IsFounder( user ) ) { m_tiptext += _("Host\n"); } else { m_tiptext += _("Client\n"); } if ( user.BattleStatus().ready ) { m_tiptext += _("Ready\n"); } else { m_tiptext += _("Not ready\n"); } if ( user.BattleStatus().sync == SYNC_SYNCED ) { m_tiptext += _("In sync"); } else { m_tiptext += _("Not in sync"); } } else if ( column == m_faction_column_index ) // icon { m_tiptext = _T(""); if ( user.BattleStatus().spectator ) { m_tiptext = _T("Spectators have no side"); } else { try { const auto sides = LSL::usync().GetSides(STD_STRING(m_battle->GetHostModName())); const int side = user.BattleStatus().side; if ( side < (int)sides.size() ) m_tiptext = TowxString(sides[side]); } catch (...){} } } else if ( column == m_ingame_column_index ) // lobby status { m_tiptext = _T( "This " ); if ( user.GetStatus().bot ) { m_tiptext << _T( "bot " ); } else if ( user.GetStatus().moderator ) { m_tiptext << _T( "moderator " ); } else { m_tiptext << _T( "player " ); } if ( user.GetStatus().in_game ) { m_tiptext << _T( "is ingame" ); } else if ( user.GetStatus().away ) { m_tiptext << _T( "is away" ); } else { m_tiptext << _T( "is available" ); } } else if ( column == m_country_column_index ) // country { m_tiptext = user.BattleStatus().IsBot() ? _T("This bot is from nowhere particular") : GetFlagNameFromCountryCode(user.GetCountry()); } else if ( column == m_rank_column_index ) // rank { m_tiptext = user.BattleStatus().IsBot() ? _T("This bot has no rank") : user.GetRankName(user.GetStatus().rank); } else if ( column == m_nick_column_index ) //name { m_tiptext = user.BattleStatus().IsBot() ?user.GetNick() : user.GetNick(); } else m_tiptext = m_colinfovec[column].tip; } }
void BattleListCtrl::SetTipWindowText( const long item_hit, const wxPoint& position) { if ( (long)m_data.size() < item_hit ) { m_tiptext = _T(""); return; } const IBattle& battle= *m_data[item_hit]; int column = getColumnFromPosition(position); switch (column) { case 0: // status m_tiptext = icons().GetBattleStatus(battle); break; case 1: // country try { m_tiptext = GetFlagNameFromCountryCode(battle.GetFounder().GetCountry()); }catch(...){} break; case 2: // rank_min m_tiptext = m_colinfovec[column].tip; break; case 3: // descrp m_tiptext = battle.GetDescription(); break; case 4: //map m_tiptext = battle.GetHostMapName(); break; case 5: //mod m_tiptext = battle.GetHostModName(); break; case 6: // host try { m_tiptext = battle.GetFounder().GetNick(); }catch(...){} break; case 7: // specs m_tiptext = _("Spectators:"); for (unsigned int i = 0; i < battle.GetNumUsers(); ++i ) { if ( battle.GetUser(i).BattleStatus().spectator ) m_tiptext << _T("\n") << battle.GetUser(i).GetNick(); } break; case 8: // player m_tiptext = _("Active Players:"); for ( unsigned int i = 0; i < battle.GetNumUsers(); ++i ) { if ( !battle.GetUser(i).BattleStatus().spectator ) m_tiptext << _T("\n") << battle.GetUser(i).GetNick(); } break; case 9: //max player m_tiptext = (m_colinfovec[column].tip); break; case 10: //running time m_tiptext = (m_colinfovec[column].tip); break; default: m_tiptext = _T(""); break; } }