serverbrowser: rewrite according my expectations
This commit is contained in:
parent
efbcaf7820
commit
2b2ca63b48
@ -46,13 +46,13 @@ bool GameSupportsReplay()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//--------------------------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------------------------
|
||||||
bool IsReplayServer( gameserveritem_t &server )
|
bool IsReplayServer( newgameserver_t &server )
|
||||||
{
|
{
|
||||||
bool bReplay = false;
|
bool bReplay = false;
|
||||||
|
|
||||||
if ( GameSupportsReplay() )
|
if ( GameSupportsReplay() )
|
||||||
{
|
{
|
||||||
if ( server.m_szGameTags && server.m_szGameTags[0] )
|
if ( server.m_szGameTags[0] )
|
||||||
{
|
{
|
||||||
CUtlVector<char*> TagList;
|
CUtlVector<char*> TagList;
|
||||||
V_SplitString( server.m_szGameTags, ",", TagList );
|
V_SplitString( server.m_szGameTags, ",", TagList );
|
||||||
@ -156,11 +156,11 @@ CBaseGamesPage::CBaseGamesPage( vgui::Panel *parent, const char *name, EPageType
|
|||||||
m_pConnect = new Button(this, "ConnectButton", "#ServerBrowser_Connect");
|
m_pConnect = new Button(this, "ConnectButton", "#ServerBrowser_Connect");
|
||||||
m_pConnect->SetEnabled(false);
|
m_pConnect->SetEnabled(false);
|
||||||
m_pRefreshAll = new Button(this, "RefreshButton", "#ServerBrowser_Refresh");
|
m_pRefreshAll = new Button(this, "RefreshButton", "#ServerBrowser_Refresh");
|
||||||
m_pRefreshQuick = new Button(this, "RefreshQuickButton", "#ServerBrowser_RefreshQuick");
|
|
||||||
m_pAddServer = new Button(this, "AddServerButton", "#ServerBrowser_AddServer");
|
m_pAddServer = new Button(this, "AddServerButton", "#ServerBrowser_AddServer");
|
||||||
m_pAddCurrentServer = new Button(this, "AddCurrentServerButton", "#ServerBrowser_AddCurrentServer");
|
m_pAddCurrentServer = new Button(this, "AddCurrentServerButton", "#ServerBrowser_AddCurrentServer");
|
||||||
m_pGameList = new CGameListPanel(this, "gamelist");
|
m_pGameList = new CGameListPanel(this, "gamelist");
|
||||||
m_pGameList->SetAllowUserModificationOfColumns(true);
|
m_pGameList->SetAllowUserModificationOfColumns(true);
|
||||||
|
m_pRefreshQuick = new Button(this, "RefreshQuickButton", "#ServerBrowser_RefreshQuick");
|
||||||
|
|
||||||
m_pQuickList = new PanelListPanel(this, "quicklist");
|
m_pQuickList = new PanelListPanel(this, "quicklist");
|
||||||
m_pQuickList->SetFirstColumnWidth( 0 );
|
m_pQuickList->SetFirstColumnWidth( 0 );
|
||||||
@ -191,14 +191,14 @@ CBaseGamesPage::CBaseGamesPage( vgui::Panel *parent, const char *name, EPageType
|
|||||||
300, // maxwidth
|
300, // maxwidth
|
||||||
0 // flags
|
0 // flags
|
||||||
);
|
);
|
||||||
m_pGameList->AddColumnHeader( k_nColumn_Players, "Players", "#ServerBrowser_Players", 55, ListPanel::COLUMN_FIXEDSIZE);
|
m_pGameList->AddColumnHeader( k_nColumn_Players, "Players", "#ServerBrowser_Players", 80, ListPanel::COLUMN_FIXEDSIZE);
|
||||||
m_pGameList->AddColumnHeader( k_nColumn_Bots, "Bots", "#ServerBrowser_Bots", 40, ListPanel::COLUMN_FIXEDSIZE);
|
m_pGameList->AddColumnHeader( k_nColumn_Bots, "Bots", "#ServerBrowser_Bots", 60, ListPanel::COLUMN_FIXEDSIZE);
|
||||||
m_pGameList->AddColumnHeader( k_nColumn_Map, "Map", "#ServerBrowser_Map", 90,
|
m_pGameList->AddColumnHeader( k_nColumn_Map, "Map", "#ServerBrowser_Map", 90,
|
||||||
90, // minwidth
|
90, // minwidth
|
||||||
300, // maxwidth
|
300, // maxwidth
|
||||||
0 // flags
|
0 // flags
|
||||||
);
|
);
|
||||||
m_pGameList->AddColumnHeader( k_nColumn_Ping, "Ping", "#ServerBrowser_Latency", 55, ListPanel::COLUMN_FIXEDSIZE);
|
m_pGameList->AddColumnHeader( k_nColumn_Ping, "Ping", "#ServerBrowser_Latency", 55, ListPanel::COLUMN_RESIZEWITHWINDOW);
|
||||||
|
|
||||||
m_pGameList->SetColumnHeaderTooltip( k_nColumn_Password, "#ServerBrowser_PasswordColumn_Tooltip");
|
m_pGameList->SetColumnHeaderTooltip( k_nColumn_Password, "#ServerBrowser_PasswordColumn_Tooltip");
|
||||||
m_pGameList->SetColumnHeaderTooltip( k_nColumn_Bots, "#ServerBrowser_BotColumn_Tooltip");
|
m_pGameList->SetColumnHeaderTooltip( k_nColumn_Bots, "#ServerBrowser_BotColumn_Tooltip");
|
||||||
@ -280,12 +280,10 @@ void CBaseGamesPage::PerformLayout()
|
|||||||
|
|
||||||
if (SupportsItem(IGameList::GETNEWLIST))
|
if (SupportsItem(IGameList::GETNEWLIST))
|
||||||
{
|
{
|
||||||
m_pRefreshQuick->SetVisible(true);
|
|
||||||
m_pRefreshAll->SetText("#ServerBrowser_RefreshAll");
|
m_pRefreshAll->SetText("#ServerBrowser_RefreshAll");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pRefreshQuick->SetVisible(false);
|
|
||||||
m_pRefreshAll->SetText("#ServerBrowser_Refresh");
|
m_pRefreshAll->SetText("#ServerBrowser_Refresh");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,25 +311,8 @@ void CBaseGamesPage::PerformLayout()
|
|||||||
m_pRefreshAll->SetText( "#ServerBrowser_StopRefreshingList" );
|
m_pRefreshAll->SetText( "#ServerBrowser_StopRefreshingList" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pGameList->GetItemCount() > 0)
|
m_pRefreshQuick->SetVisible( false );
|
||||||
{
|
m_pFilter->SetVisible(false);
|
||||||
m_pRefreshQuick->SetEnabled(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_pRefreshQuick->SetEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if ( !steamapicontext->SteamMatchmakingServers() || !steamapicontext->SteamMatchmaking() )
|
|
||||||
{
|
|
||||||
m_pAddCurrentServer->SetVisible( false );
|
|
||||||
m_pRefreshQuick->SetEnabled( false );
|
|
||||||
m_pAddServer->SetEnabled( false );
|
|
||||||
m_pConnect->SetEnabled( false );
|
|
||||||
m_pRefreshAll->SetEnabled( false );
|
|
||||||
m_pAddToFavoritesButton->SetEnabled( false );
|
|
||||||
m_pGameList->SetEmptyListText( "#ServerBrowser_SteamRunning" );
|
|
||||||
}*/
|
|
||||||
|
|
||||||
Repaint();
|
Repaint();
|
||||||
}
|
}
|
||||||
@ -378,20 +359,6 @@ struct serverqualitysort_t
|
|||||||
|
|
||||||
int ServerQualitySort( const serverqualitysort_t *pSQ1, const serverqualitysort_t *pSQ2 )
|
int ServerQualitySort( const serverqualitysort_t *pSQ1, const serverqualitysort_t *pSQ2 )
|
||||||
{
|
{
|
||||||
int iMaxP = sb_mod_suggested_maxplayers.GetInt();
|
|
||||||
if ( iMaxP && pSQ1->iMaxPlayerCount != pSQ2->iMaxPlayerCount )
|
|
||||||
{
|
|
||||||
if ( pSQ1->iMaxPlayerCount > iMaxP )
|
|
||||||
return 1;
|
|
||||||
if ( pSQ2->iMaxPlayerCount > iMaxP )
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( pSQ1->iPing <= 100 && pSQ2->iPing <= 100 && pSQ1->iPlayerCount != pSQ2->iPlayerCount )
|
|
||||||
{
|
|
||||||
return pSQ2->iPlayerCount - pSQ1->iPlayerCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return pSQ1->iPing - pSQ2->iPing;
|
return pSQ1->iPing - pSQ2->iPing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -400,156 +367,72 @@ int ServerQualitySort( const serverqualitysort_t *pSQ1, const serverqualitysort_
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CBaseGamesPage::SelectQuickListServers( void )
|
void CBaseGamesPage::SelectQuickListServers( void )
|
||||||
{
|
{
|
||||||
int iIndex = m_pQuickList->FirstItem();
|
|
||||||
|
|
||||||
while ( iIndex != m_pQuickList->InvalidItemID() )
|
|
||||||
{
|
|
||||||
CQuickListPanel *pQuickListPanel = dynamic_cast< CQuickListPanel *> ( m_pQuickList->GetItemPanel( iIndex ) );
|
|
||||||
|
|
||||||
if ( pQuickListPanel )
|
|
||||||
{
|
|
||||||
CUtlVector< serverqualitysort_t > vecServerQuality;
|
|
||||||
|
|
||||||
int iElement = m_quicklistserverlist.Find( pQuickListPanel->GetName() );
|
|
||||||
|
|
||||||
if ( iElement != m_quicklistserverlist.InvalidIndex() )
|
|
||||||
{
|
|
||||||
CQuickListMapServerList *vecMapServers = &m_quicklistserverlist[iElement];
|
|
||||||
|
|
||||||
if ( vecMapServers )
|
|
||||||
{
|
|
||||||
for ( int i =0; i < vecMapServers->Count(); i++ )
|
|
||||||
{
|
|
||||||
int iListID = vecMapServers->Element( i );
|
|
||||||
|
|
||||||
serverqualitysort_t serverquality;
|
|
||||||
|
|
||||||
serverquality.iIndex = iListID;
|
|
||||||
|
|
||||||
KeyValues *kv = NULL;
|
|
||||||
if ( m_pGameList->IsValidItemID( iListID ) )
|
|
||||||
{
|
|
||||||
kv = m_pGameList->GetItem( iListID );
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( kv )
|
|
||||||
{
|
|
||||||
serverquality.iPing = kv->GetInt( "ping", 0 );
|
|
||||||
serverquality.iPlayerCount = kv->GetInt( "PlayerCount", 0 );
|
|
||||||
serverquality.iMaxPlayerCount = kv->GetInt( "MaxPlayerCount", 0 );
|
|
||||||
}
|
|
||||||
|
|
||||||
vecServerQuality.AddToTail( serverquality );
|
|
||||||
}
|
|
||||||
|
|
||||||
vecServerQuality.Sort( ServerQualitySort );
|
|
||||||
|
|
||||||
serverqualitysort_t bestserver = vecServerQuality.Head();
|
|
||||||
|
|
||||||
if ( m_pGameList->IsValidItemID( bestserver.iIndex ) )
|
|
||||||
{
|
|
||||||
pQuickListPanel->SetServerInfo( m_pGameList->GetItem( bestserver.iIndex ), bestserver.iIndex, vecServerQuality.Count() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
iIndex = m_pQuickList->NextItem( iIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
//Force the connect button to recalculate its state.
|
|
||||||
OnItemSelected();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ServerMapnameSortFunc( const servermaps_t *p1, const servermaps_t *p2 )
|
int ServerPingSortFunc( const serverping_t *p1, const serverping_t *p2 )
|
||||||
{
|
{
|
||||||
//If they're both on disc OR both missing then sort them alphabetically
|
return p1->m_nPing - p2->m_nPing;
|
||||||
if ( (p1->bOnDisk && p2->bOnDisk) || (!p1->bOnDisk && !p2->bOnDisk ) )
|
|
||||||
return Q_strcmp( p1->pFriendlyName, p2->pFriendlyName );
|
|
||||||
|
|
||||||
//Otherwise maps you have show up first
|
|
||||||
return p2->bOnDisk - p1->bOnDisk;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: prepares all the QuickListPanel map panels...
|
// Purpose: prepares all the QuickListPanel map panels...
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CBaseGamesPage::PrepareQuickListMap( const char *pMapName, int iListID )
|
void CBaseGamesPage::PrepareQuickListMap( newgameserver_t *server, int iListID )
|
||||||
{
|
{
|
||||||
char szMapName[ 512 ];
|
char szMapName[ 512 ];
|
||||||
Q_snprintf( szMapName, sizeof( szMapName ), "%s", pMapName );
|
Q_snprintf( szMapName, sizeof( szMapName ), "%s", server->m_szMap );
|
||||||
|
|
||||||
Q_strlower( szMapName );
|
Q_strlower( szMapName );
|
||||||
|
|
||||||
char path[ 512 ];
|
char path[ 512 ];
|
||||||
Q_snprintf( path, sizeof( path ), "maps/%s.bsp", szMapName );
|
Q_snprintf( path, sizeof( path ), "maps/%s.bsp", szMapName );
|
||||||
|
|
||||||
int iIndex = m_quicklistserverlist.Find( szMapName );
|
|
||||||
|
|
||||||
if ( m_quicklistserverlist.IsValidIndex( iIndex ) == false )
|
char szFriendlyName[MAX_MAP_NAME];
|
||||||
|
const char *pszFriendlyGameTypeName = ServerBrowser().GetMapFriendlyNameAndGameType( szMapName, szFriendlyName, sizeof(szFriendlyName) );
|
||||||
|
|
||||||
|
//Add the map to our list of panels.
|
||||||
|
if ( m_pQuickList )
|
||||||
{
|
{
|
||||||
CQuickListMapServerList vecMapServers;
|
serverping_t serverping;
|
||||||
iIndex = m_quicklistserverlist.Insert( szMapName, vecMapServers );
|
const char *pFriendlyName = CloneString( szFriendlyName );
|
||||||
|
const char *pOriginalName = CloneString( szMapName );
|
||||||
|
|
||||||
char szFriendlyName[MAX_MAP_NAME];
|
char path[ 512 ];
|
||||||
const char *pszFriendlyGameTypeName = ServerBrowser().GetMapFriendlyNameAndGameType( szMapName, szFriendlyName, sizeof(szFriendlyName) );
|
Q_snprintf( path, sizeof( path ), "maps/%s.bsp", szMapName );
|
||||||
|
|
||||||
//Add the map to our list of panels.
|
CQuickListPanel *pQuickListPanel = new CQuickListPanel( m_pQuickList, "QuickListPanel");
|
||||||
if ( m_pQuickList )
|
|
||||||
|
if ( pQuickListPanel )
|
||||||
{
|
{
|
||||||
servermaps_t servermap;
|
pQuickListPanel->InvalidateLayout();
|
||||||
|
pQuickListPanel->SetName( pOriginalName );
|
||||||
|
pQuickListPanel->SetMapName( pFriendlyName );
|
||||||
|
pQuickListPanel->SetImage( pOriginalName );
|
||||||
|
pQuickListPanel->SetGameType( pszFriendlyGameTypeName );
|
||||||
|
pQuickListPanel->SetVisible( true );
|
||||||
|
pQuickListPanel->SetRefreshing();
|
||||||
|
pQuickListPanel->SetServerInfo( m_pGameList->GetItem( iListID ), iListID, 1 );
|
||||||
|
|
||||||
servermap.pFriendlyName = CloneString( szFriendlyName );
|
serverping.iPanelIndex = m_pQuickList->AddItem( NULL, pQuickListPanel );
|
||||||
servermap.pOriginalName = CloneString( szMapName );
|
|
||||||
|
|
||||||
char path[ 512 ];
|
serverping.m_nPing = server->m_nPing;
|
||||||
Q_snprintf( path, sizeof( path ), "maps/%s.bsp", szMapName );
|
|
||||||
|
|
||||||
servermap.bOnDisk = g_pFullFileSystem->FileExists( path, "MOD" );
|
m_vecServersFound.AddToTail( serverping );
|
||||||
|
m_vecServersFound.Sort( ServerPingSortFunc );
|
||||||
CQuickListPanel *pQuickListPanel = new CQuickListPanel( m_pQuickList, "QuickListPanel");
|
|
||||||
|
|
||||||
if ( pQuickListPanel )
|
|
||||||
{
|
|
||||||
pQuickListPanel->InvalidateLayout();
|
|
||||||
pQuickListPanel->SetName( servermap.pOriginalName );
|
|
||||||
pQuickListPanel->SetMapName( servermap.pFriendlyName );
|
|
||||||
pQuickListPanel->SetImage( servermap.pOriginalName );
|
|
||||||
pQuickListPanel->SetGameType( pszFriendlyGameTypeName );
|
|
||||||
pQuickListPanel->SetVisible( true );
|
|
||||||
pQuickListPanel->SetRefreshing();
|
|
||||||
|
|
||||||
servermap.iPanelIndex = m_pQuickList->AddItem( NULL, pQuickListPanel );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_vecMapNamesFound.AddToTail( servermap );
|
|
||||||
m_vecMapNamesFound.Sort( ServerMapnameSortFunc );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Now make sure that list is sorted.
|
|
||||||
CUtlVector<int> *pPanelSort = m_pQuickList->GetSortedVector();
|
|
||||||
|
|
||||||
if ( pPanelSort )
|
|
||||||
{
|
|
||||||
pPanelSort->RemoveAll();
|
|
||||||
|
|
||||||
for ( int i = 0; i < m_vecMapNamesFound.Count(); i++ )
|
|
||||||
{
|
|
||||||
pPanelSort->AddToTail( m_vecMapNamesFound[i].iPanelIndex );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( iIndex != m_quicklistserverlist.InvalidIndex() )
|
//Now make sure that list is sorted.
|
||||||
{
|
CUtlVector<int> *pPanelSort = m_pQuickList->GetSortedVector();
|
||||||
CQuickListMapServerList *vecMapServers = &m_quicklistserverlist[iIndex];
|
|
||||||
|
|
||||||
if ( vecMapServers )
|
if ( pPanelSort )
|
||||||
|
{
|
||||||
|
pPanelSort->RemoveAll();
|
||||||
|
|
||||||
|
for ( int i = 0; i < m_vecServersFound.Count(); i++ )
|
||||||
{
|
{
|
||||||
if ( vecMapServers->Find( iListID ) == vecMapServers->InvalidIndex() )
|
pPanelSort->AddToTail( m_vecServersFound[i].iPanelIndex );
|
||||||
{
|
|
||||||
vecMapServers->AddToTail( iListID );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -557,21 +440,10 @@ void CBaseGamesPage::PrepareQuickListMap( const char *pMapName, int iListID )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: gets information about specified server
|
// Purpose: gets information about specified server
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
gameserveritem_t *CBaseGamesPage::GetServer( unsigned int serverID )
|
newgameserver_t *CBaseGamesPage::GetServer( unsigned int serverID )
|
||||||
{
|
{
|
||||||
if ( !steamapicontext->SteamMatchmakingServers() )
|
if( serverID >= m_serversInfo.Count() ) return NULL;
|
||||||
return NULL;
|
return &m_serversInfo[serverID];
|
||||||
|
|
||||||
// No point checking for >= 0 when serverID is unsigned.
|
|
||||||
//if ( serverID >= 0 )
|
|
||||||
{
|
|
||||||
return steamapicontext->SteamMatchmakingServers()->GetServerDetails( m_hRequest, serverID );
|
|
||||||
}
|
|
||||||
//else
|
|
||||||
//{
|
|
||||||
// Assert( !"Unable to return a useful entry" );
|
|
||||||
// return NULL; // bugbug Alfred: temp Favorites/History objects won't return a good value here...
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -680,8 +552,8 @@ void CBaseGamesPage::CreateFilters()
|
|||||||
int iItemID = m_pGameFilter->AddItem(ModList().GetModName(i), pkv);
|
int iItemID = m_pGameFilter->AddItem(ModList().GetModName(i), pkv);
|
||||||
m_mapGamesFilterItem.Insert( ModList().GetAppID(i).ToUint64(), iItemID );
|
m_mapGamesFilterItem.Insert( ModList().GetAppID(i).ToUint64(), iItemID );
|
||||||
}
|
}
|
||||||
pkv->deleteThis();
|
|
||||||
|
|
||||||
|
pkv->deleteThis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -710,7 +582,7 @@ void CBaseGamesPage::LoadFilterSettings()
|
|||||||
m_bFilterNoEmptyServers = filter->GetInt("NoEmpty");
|
m_bFilterNoEmptyServers = filter->GetInt("NoEmpty");
|
||||||
m_bFilterNoPasswordedServers = filter->GetInt("NoPassword");
|
m_bFilterNoPasswordedServers = filter->GetInt("NoPassword");
|
||||||
m_bFilterReplayServers = filter->GetInt("Replay");
|
m_bFilterReplayServers = filter->GetInt("Replay");
|
||||||
m_pQuickListCheckButton->SetSelected( filter->GetInt( "QuickList", 0 ) );
|
m_pQuickListCheckButton->SetSelected( filter->GetInt( "QuickList", IsAndroid() ) );
|
||||||
|
|
||||||
int secureFilter = filter->GetInt("Secure");
|
int secureFilter = filter->GetInt("Secure");
|
||||||
m_pSecureFilter->ActivateItem(secureFilter);
|
m_pSecureFilter->ActivateItem(secureFilter);
|
||||||
@ -1005,7 +877,13 @@ void CBaseGamesPage::UpdateFilterAndQuickListVisibility()
|
|||||||
|
|
||||||
int wide, tall;
|
int wide, tall;
|
||||||
GetSize( wide, tall );
|
GetSize( wide, tall );
|
||||||
SetSize( 624, 278 );
|
|
||||||
|
int w = 640; int h = 384;
|
||||||
|
|
||||||
|
w = IsProportional() ? vgui::scheme()->GetProportionalScaledValue(w) : w;
|
||||||
|
h = IsProportional() ? vgui::scheme()->GetProportionalScaledValue(h) : h;
|
||||||
|
|
||||||
|
SetSize( w, h );
|
||||||
|
|
||||||
UpdateDerivedLayouts();
|
UpdateDerivedLayouts();
|
||||||
UpdateGameFilter();
|
UpdateGameFilter();
|
||||||
@ -1018,12 +896,10 @@ void CBaseGamesPage::UpdateFilterAndQuickListVisibility()
|
|||||||
|
|
||||||
SetSize( wide, tall );
|
SetSize( wide, tall );
|
||||||
|
|
||||||
|
|
||||||
m_pQuickList->SetVisible( showQuickList );
|
m_pQuickList->SetVisible( showQuickList );
|
||||||
m_pGameList->SetVisible( !showQuickList );
|
m_pGameList->SetVisible( !showQuickList );
|
||||||
m_pFilter->SetVisible( !showQuickList );
|
m_pFilter->SetVisible( !showQuickList );
|
||||||
m_pFilterString->SetVisible ( !showQuickList );
|
m_pFilterString->SetVisible ( !showQuickList );
|
||||||
|
|
||||||
|
|
||||||
InvalidateLayout();
|
InvalidateLayout();
|
||||||
|
|
||||||
@ -1638,7 +1514,6 @@ void CBaseGamesPage::SetRefreshing(bool state)
|
|||||||
m_pGameList->SetEmptyListText("");
|
m_pGameList->SetEmptyListText("");
|
||||||
m_pRefreshAll->SetText("#ServerBrowser_StopRefreshingList");
|
m_pRefreshAll->SetText("#ServerBrowser_StopRefreshingList");
|
||||||
m_pRefreshAll->SetCommand("stoprefresh");
|
m_pRefreshAll->SetCommand("stoprefresh");
|
||||||
m_pRefreshQuick->SetEnabled(false);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1654,14 +1529,6 @@ void CBaseGamesPage::SetRefreshing(bool state)
|
|||||||
m_pRefreshAll->SetCommand("GetNewList");
|
m_pRefreshAll->SetCommand("GetNewList");
|
||||||
|
|
||||||
// 'refresh quick' button is only enabled if there are servers in the list
|
// 'refresh quick' button is only enabled if there are servers in the list
|
||||||
if (m_pGameList->GetItemCount() > 0)
|
|
||||||
{
|
|
||||||
m_pRefreshQuick->SetEnabled(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_pRefreshQuick->SetEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1762,7 +1629,7 @@ int CBaseGamesPage::GetSelectedItemsCount()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CBaseGamesPage::OnAddToFavorites()
|
void CBaseGamesPage::OnAddToFavorites()
|
||||||
{
|
{
|
||||||
if ( !steamapicontext->SteamMatchmakingServers() )
|
/* if ( !steamapicontext->SteamMatchmakingServers() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// loop through all the selected favorites
|
// loop through all the selected favorites
|
||||||
@ -1776,7 +1643,7 @@ void CBaseGamesPage::OnAddToFavorites()
|
|||||||
// add to favorites list
|
// add to favorites list
|
||||||
ServerBrowserDialog().AddServerToFavorites(*pServer);
|
ServerBrowserDialog().AddServerToFavorites(*pServer);
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1838,6 +1705,8 @@ void CBaseGamesPage::StartRefresh()
|
|||||||
MatchMakingKeyValuePair_t *pFilters;
|
MatchMakingKeyValuePair_t *pFilters;
|
||||||
int nFilters = GetServerFilters( &pFilters );
|
int nFilters = GetServerFilters( &pFilters );
|
||||||
|
|
||||||
|
m_serversInfo.SetCount(0);
|
||||||
|
|
||||||
/* if ( m_hRequest )
|
/* if ( m_hRequest )
|
||||||
{
|
{
|
||||||
steamapicontext->SteamMatchmakingServers()->ReleaseRequest( m_hRequest );
|
steamapicontext->SteamMatchmakingServers()->ReleaseRequest( m_hRequest );
|
||||||
@ -1852,7 +1721,6 @@ void CBaseGamesPage::StartRefresh()
|
|||||||
m_hRequest = steamapicontext->SteamMatchmakingServers()->RequestHistoryServerList( GetFilterAppID().AppID(), &pFilters, nFilters, this );
|
m_hRequest = steamapicontext->SteamMatchmakingServers()->RequestHistoryServerList( GetFilterAppID().AppID(), &pFilters, nFilters, this );
|
||||||
break;*/
|
break;*/
|
||||||
case eInternetServer:
|
case eInternetServer:
|
||||||
Msg("RequestInternetServerList\n");
|
|
||||||
g_pServersInfo->RequestInternetServerList(COM_GetModDirectory(), this);
|
g_pServersInfo->RequestInternetServerList(COM_GetModDirectory(), this);
|
||||||
//m_hRequest = steamapicontext->SteamMatchmakingServers()->RequestInternetServerList( GetFilterAppID().AppID(), &pFilters, nFilters, this );
|
//m_hRequest = steamapicontext->SteamMatchmakingServers()->RequestInternetServerList( GetFilterAppID().AppID(), &pFilters, nFilters, this );
|
||||||
break;
|
break;
|
||||||
@ -1878,20 +1746,7 @@ void CBaseGamesPage::StartRefresh()
|
|||||||
void CBaseGamesPage::ClearQuickList( void )
|
void CBaseGamesPage::ClearQuickList( void )
|
||||||
{
|
{
|
||||||
m_pQuickList->DeleteAllItems();
|
m_pQuickList->DeleteAllItems();
|
||||||
m_vecMapNamesFound.RemoveAll();
|
m_vecServersFound.RemoveAll();
|
||||||
|
|
||||||
int iIndex = m_quicklistserverlist.First();
|
|
||||||
|
|
||||||
while ( iIndex != m_quicklistserverlist.InvalidIndex() )
|
|
||||||
{
|
|
||||||
CQuickListMapServerList *vecMapServers = &m_quicklistserverlist[iIndex];
|
|
||||||
|
|
||||||
vecMapServers->RemoveAll();
|
|
||||||
|
|
||||||
iIndex = m_quicklistserverlist.Next( iIndex );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_quicklistserverlist.RemoveAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -1925,8 +1780,7 @@ void CBaseGamesPage::StopRefresh()
|
|||||||
m_iServerRefreshCount = 0;
|
m_iServerRefreshCount = 0;
|
||||||
|
|
||||||
// Stop the server list refreshing
|
// Stop the server list refreshing
|
||||||
if ( steamapicontext->SteamMatchmakingServers() )
|
g_pServersInfo->StopRefresh();
|
||||||
steamapicontext->SteamMatchmakingServers()->CancelQuery( m_hRequest );
|
|
||||||
|
|
||||||
// update UI
|
// update UI
|
||||||
RefreshComplete( nServerResponded );
|
RefreshComplete( nServerResponded );
|
||||||
@ -1940,7 +1794,8 @@ void CBaseGamesPage::StopRefresh()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CBaseGamesPage::RefreshComplete( NServerResponse response )
|
void CBaseGamesPage::RefreshComplete( NServerResponse response )
|
||||||
{
|
{
|
||||||
SelectQuickListServers();
|
//Force the connect button to recalculate its state.
|
||||||
|
OnItemSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -2235,12 +2090,7 @@ void CBaseGamesPage::ServerResponded( newgameserver_t &server )
|
|||||||
kv->SetString("GameDir", pServerItem->m_szGameDir);
|
kv->SetString("GameDir", pServerItem->m_szGameDir);
|
||||||
kv->SetString("GameDesc", pServerItem->m_szGameDescription);
|
kv->SetString("GameDesc", pServerItem->m_szGameDescription);
|
||||||
kv->SetInt("password", pServerItem->m_bPassword ? m_nImageIndexPassword : 0);
|
kv->SetInt("password", pServerItem->m_bPassword ? m_nImageIndexPassword : 0);
|
||||||
|
kv->SetInt("bots", pServerItem->m_nBotPlayers);
|
||||||
if ( pServerItem->m_nBotPlayers > 0 )
|
|
||||||
kv->SetInt("bots", pServerItem->m_nBotPlayers);
|
|
||||||
else
|
|
||||||
kv->SetString("bots", "");
|
|
||||||
|
|
||||||
|
|
||||||
kv->SetInt("secure", 0);
|
kv->SetInt("secure", 0);
|
||||||
|
|
||||||
@ -2257,51 +2107,21 @@ void CBaseGamesPage::ServerResponded( newgameserver_t &server )
|
|||||||
|
|
||||||
kv->SetInt("Ping", pServerItem->m_nPing);
|
kv->SetInt("Ping", pServerItem->m_nPing);
|
||||||
|
|
||||||
kv->SetString("Tags", "");
|
kv->SetString("Tags", pServerItem->m_szGameTags);
|
||||||
|
|
||||||
kv->SetInt("Replay", 0);
|
kv->SetInt("Replay", 0);
|
||||||
|
|
||||||
/* if ( pServerItem->m_ulTimeLastPlayed )
|
|
||||||
{
|
|
||||||
// construct a time string for last played time
|
|
||||||
struct tm *now;
|
|
||||||
now = localtime( (time_t*)&pServerItem->m_ulTimeLastPlayed );
|
|
||||||
|
|
||||||
if ( now )
|
|
||||||
{
|
|
||||||
char buf[64];
|
|
||||||
strftime(buf, sizeof(buf), "%a %d %b %I:%M%p", now);
|
|
||||||
Q_strlower(buf + strlen(buf) - 4);
|
|
||||||
kv->SetString("LastPlayed", buf);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
int iServerIndex = m_serversInfo.AddToTail( server );
|
int iServerIndex = m_serversInfo.AddToTail( server );
|
||||||
|
|
||||||
//if ( !m_pGameList->IsValidItemID( pServer->m_iListID ) )
|
// new server, add to list
|
||||||
|
int iListID = m_pGameList->AddItem(kv, iServerIndex, false, false);
|
||||||
|
|
||||||
// new server, add to list
|
m_pGameList->SetItemVisible( iListID, true );
|
||||||
int iListID = m_pGameList->AddItem(kv, iServerIndex, false, false);
|
kv->deleteThis();
|
||||||
/*if ( m_bAutoSelectFirstItemInGameList && m_pGameList->GetItemCount() == 1 )
|
|
||||||
{
|
|
||||||
m_pGameList->AddSelectedItem( pServer->m_iListID );
|
|
||||||
}*/
|
|
||||||
|
|
||||||
m_pGameList->SetItemVisible( iListID, true );
|
PrepareQuickListMap( &server, iListID );
|
||||||
|
|
||||||
kv->deleteThis();
|
|
||||||
|
|
||||||
/* else
|
|
||||||
{
|
|
||||||
// tell the list that we've changed the data
|
|
||||||
m_pGameList->ApplyItemChanges( pServer->m_iListID );
|
|
||||||
m_pGameList->SetItemVisible( pServer->m_iListID, !removeItem );
|
|
||||||
}*/
|
|
||||||
|
|
||||||
PrepareQuickListMap( pServerItem->m_szMap, iListID );
|
|
||||||
UpdateStatus();
|
UpdateStatus();
|
||||||
m_iServerRefreshCount++;
|
m_iServerRefreshCount++;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -66,12 +66,10 @@ public:
|
|||||||
virtual void OnCursorExited();
|
virtual void OnCursorExited();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct servermaps_t
|
struct serverping_t
|
||||||
{
|
{
|
||||||
const char *pOriginalName;
|
int m_nPing;
|
||||||
const char *pFriendlyName;
|
int iPanelIndex;
|
||||||
int iPanelIndex;
|
|
||||||
bool bOnDisk;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct gametypes_t
|
struct gametypes_t
|
||||||
@ -120,7 +118,7 @@ public:
|
|||||||
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
|
virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
|
||||||
|
|
||||||
// gets information about specified server
|
// gets information about specified server
|
||||||
virtual gameserveritem_t *GetServer(unsigned int serverID);
|
virtual newgameserver_t *GetServer(unsigned int serverID);
|
||||||
virtual const char *GetConnectCode();
|
virtual const char *GetConnectCode();
|
||||||
|
|
||||||
uint32 GetServerFilters( MatchMakingKeyValuePair_t **pFilters );
|
uint32 GetServerFilters( MatchMakingKeyValuePair_t **pFilters );
|
||||||
@ -144,7 +142,7 @@ public:
|
|||||||
|
|
||||||
virtual void UpdateDerivedLayouts( void );
|
virtual void UpdateDerivedLayouts( void );
|
||||||
|
|
||||||
void PrepareQuickListMap( const char *pMapName, int iListID );
|
void PrepareQuickListMap( newgameserver_t *server, int iListID );
|
||||||
void SelectQuickListServers( void );
|
void SelectQuickListServers( void );
|
||||||
vgui::Panel *GetActiveList( void );
|
vgui::Panel *GetActiveList( void );
|
||||||
virtual bool IsQuickListButtonChecked()
|
virtual bool IsQuickListButtonChecked()
|
||||||
@ -242,7 +240,7 @@ protected:
|
|||||||
CUtlVector<MatchMakingKeyValuePair_t> m_vecServerFilters;
|
CUtlVector<MatchMakingKeyValuePair_t> m_vecServerFilters;
|
||||||
CUtlDict< CQuickListMapServerList, int > m_quicklistserverlist;
|
CUtlDict< CQuickListMapServerList, int > m_quicklistserverlist;
|
||||||
int m_iServerRefreshCount;
|
int m_iServerRefreshCount;
|
||||||
CUtlVector< servermaps_t > m_vecMapNamesFound;
|
CUtlVector<serverping_t> m_vecServersFound;
|
||||||
|
|
||||||
|
|
||||||
EPageType m_eMatchMakingType;
|
EPageType m_eMatchMakingType;
|
||||||
|
@ -177,15 +177,13 @@ void CDialogAddServer::OnOK()
|
|||||||
|
|
||||||
if ( AllowInvalidIPs() || netaddr.IsValid() )
|
if ( AllowInvalidIPs() || netaddr.IsValid() )
|
||||||
{
|
{
|
||||||
gameserveritem_t server;
|
newgameserver_t server;
|
||||||
memset(&server, 0, sizeof(server));
|
memset(&server, 0, sizeof(server));
|
||||||
server.SetName( address );
|
strncpy( server.m_szServerName, address, sizeof(server.m_szServerName) );
|
||||||
|
|
||||||
// We assume here that the query and connection ports are the same. This is why it's much
|
// We assume here that the query and connection ports are the same. This is why it's much
|
||||||
// better if they click "Servers" and choose a server in there.
|
// better if they click "Servers" and choose a server in there.
|
||||||
server.m_NetAdr.Init( netaddr.GetIPHostByteOrder(), netaddr.GetPort(), netaddr.GetPort() );
|
server.m_NetAdr = netaddr;
|
||||||
|
|
||||||
server.m_nAppID = 0;
|
|
||||||
FinishAddServer( server );
|
FinishAddServer( server );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -257,21 +255,21 @@ void CDialogAddServer::TestServers()
|
|||||||
m_pTabPanel->AddPage( m_pDiscoveredGames, str );
|
m_pTabPanel->AddPage( m_pDiscoveredGames, str );
|
||||||
m_pTabPanel->InvalidateLayout();
|
m_pTabPanel->InvalidateLayout();
|
||||||
|
|
||||||
FOR_EACH_VEC( vecAdress, iAddress )
|
/* FOR_EACH_VEC( vecAdress, iAddress )
|
||||||
{
|
{
|
||||||
m_Queries.AddToTail( steamapicontext->SteamMatchmakingServers()->PingServer( vecAdress[ iAddress ].GetIPHostByteOrder(), vecAdress[ iAddress ].GetPort(), this ) );
|
m_Queries.AddToTail( steamapicontext->SteamMatchmakingServers()->PingServer( vecAdress[ iAddress ].GetIPHostByteOrder(), vecAdress[ iAddress ].GetPort(), this ) );
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: A server answered our ping
|
// Purpose: A server answered our ping
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CDialogAddServer::ServerResponded( gameserveritem_t &server )
|
void CDialogAddServer::ServerResponded( newgameserver_t &server )
|
||||||
{
|
{
|
||||||
KeyValues *kv = new KeyValues( "Server" );
|
KeyValues *kv = new KeyValues( "Server" );
|
||||||
|
|
||||||
kv->SetString( "name", server.GetName() );
|
kv->SetString( "name", server.m_szServerName );
|
||||||
kv->SetString( "map", server.m_szMap );
|
kv->SetString( "map", server.m_szMap );
|
||||||
kv->SetString( "GameDir", server.m_szGameDir );
|
kv->SetString( "GameDir", server.m_szGameDir );
|
||||||
kv->SetString( "GameDesc", server.m_szGameDescription );
|
kv->SetString( "GameDesc", server.m_szGameDescription );
|
||||||
@ -279,21 +277,9 @@ void CDialogAddServer::ServerResponded( gameserveritem_t &server )
|
|||||||
kv->SetInt( "password", server.m_bPassword ? 1 : 0);
|
kv->SetInt( "password", server.m_bPassword ? 1 : 0);
|
||||||
kv->SetInt( "bots", server.m_nBotPlayers ? 2 : 0);
|
kv->SetInt( "bots", server.m_nBotPlayers ? 2 : 0);
|
||||||
kv->SetInt( "Replay", IsReplayServer( server ) ? 5 : 0 );
|
kv->SetInt( "Replay", IsReplayServer( server ) ? 5 : 0 );
|
||||||
|
kv->SetInt("secure", 0);
|
||||||
|
|
||||||
if ( server.m_bSecure )
|
kv->SetString("IPAddr", server.m_NetAdr.ToString() );
|
||||||
{
|
|
||||||
// show the denied icon if banned from secure servers, the secure icon otherwise
|
|
||||||
kv->SetInt("secure", ServerBrowser().IsVACBannedFromGame( server.m_nAppID ) ? 4 : 3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
kv->SetInt("secure", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
netadr_t reportedIPAddr;
|
|
||||||
reportedIPAddr.SetIP( server.m_NetAdr.GetIP() );
|
|
||||||
reportedIPAddr.SetPort( server.m_NetAdr.GetConnectionPort() );
|
|
||||||
kv->SetString("IPAddr", reportedIPAddr.ToString() );
|
|
||||||
|
|
||||||
char buf[32];
|
char buf[32];
|
||||||
Q_snprintf(buf, sizeof(buf), "%d / %d", server.m_nPlayers, server.m_nMaxPlayers);
|
Q_snprintf(buf, sizeof(buf), "%d / %d", server.m_nPlayers, server.m_nMaxPlayers);
|
||||||
@ -366,7 +352,7 @@ void CDialogAddServer::OnItemSelected()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CDialogAddServer::FinishAddServer( gameserveritem_t &pServer )
|
void CDialogAddServer::FinishAddServer( newgameserver_t &pServer )
|
||||||
{
|
{
|
||||||
ServerBrowserDialog().AddServerToFavorites( pServer );
|
ServerBrowserDialog().AddServerToFavorites( pServer );
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class IGameList;
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Dialog which lets the user add a server by IP address
|
// Purpose: Dialog which lets the user add a server by IP address
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
class CDialogAddServer : public vgui::Frame, public ISteamMatchmakingPingResponse
|
class CDialogAddServer : public vgui::Frame //, public ISteamMatchmakingPingResponse
|
||||||
{
|
{
|
||||||
DECLARE_CLASS_SIMPLE( CDialogAddServer, vgui::Frame );
|
DECLARE_CLASS_SIMPLE( CDialogAddServer, vgui::Frame );
|
||||||
friend class CAddServerGameList;
|
friend class CAddServerGameList;
|
||||||
@ -26,7 +26,7 @@ public:
|
|||||||
CDialogAddServer(vgui::Panel *parent, IGameList *gameList);
|
CDialogAddServer(vgui::Panel *parent, IGameList *gameList);
|
||||||
~CDialogAddServer();
|
~CDialogAddServer();
|
||||||
|
|
||||||
void ServerResponded( gameserveritem_t &server );
|
void ServerResponded( newgameserver_t &server );
|
||||||
void ServerFailedToRespond();
|
void ServerFailedToRespond();
|
||||||
|
|
||||||
void ApplySchemeSettings( vgui::IScheme *pScheme );
|
void ApplySchemeSettings( vgui::IScheme *pScheme );
|
||||||
@ -40,7 +40,7 @@ private:
|
|||||||
void TestServers();
|
void TestServers();
|
||||||
MESSAGE_FUNC( OnTextChanged, "TextChanged" );
|
MESSAGE_FUNC( OnTextChanged, "TextChanged" );
|
||||||
|
|
||||||
virtual void FinishAddServer( gameserveritem_t &pServer );
|
virtual void FinishAddServer( newgameserver_t &pServer );
|
||||||
virtual bool AllowInvalidIPs( void ) { return false; }
|
virtual bool AllowInvalidIPs( void ) { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -54,7 +54,7 @@ protected:
|
|||||||
vgui::TextEntry *m_pTextEntry;
|
vgui::TextEntry *m_pTextEntry;
|
||||||
vgui::ListPanel *m_pDiscoveredGames;
|
vgui::ListPanel *m_pDiscoveredGames;
|
||||||
int m_OriginalHeight;
|
int m_OriginalHeight;
|
||||||
CUtlVector<gameserveritem_t> m_Servers;
|
CUtlVector<newgameserver_t> m_Servers;
|
||||||
CUtlVector<HServerQuery> m_Queries;
|
CUtlVector<HServerQuery> m_Queries;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ CInternetGames::CInternetGames(vgui::Panel *parent, const char *panelName, EPage
|
|||||||
m_fLastSort = 0.0f;
|
m_fLastSort = 0.0f;
|
||||||
m_bDirty = false;
|
m_bDirty = false;
|
||||||
m_bRequireUpdate = true;
|
m_bRequireUpdate = true;
|
||||||
m_bOfflineMode = false; //ro!IsSteamGameServerBrowsingEnabled();
|
m_bOfflineMode = false;
|
||||||
|
|
||||||
m_bAnyServersRetrievedFromMaster = false;
|
m_bAnyServersRetrievedFromMaster = false;
|
||||||
m_bNoServersListedOnMaster = false;
|
m_bNoServersListedOnMaster = false;
|
||||||
@ -311,7 +311,7 @@ int CInternetGames::GetRegionCodeToFilter()
|
|||||||
bool CInternetGames::CheckTagFilter( gameserveritem_t &server )
|
bool CInternetGames::CheckTagFilter( gameserveritem_t &server )
|
||||||
{
|
{
|
||||||
// Servers without tags go in the official games, servers with tags go in custom games
|
// Servers without tags go in the official games, servers with tags go in custom games
|
||||||
bool bOfficialServer = !( server.m_szGameTags && server.m_szGameTags[0] );
|
bool bOfficialServer = !server.m_szGameTags[0];
|
||||||
if ( !bOfficialServer )
|
if ( !bOfficialServer )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ void GetMostCommonQueryPorts( CUtlVector<uint16> &ports )
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
CServerBrowserDialog::CServerBrowserDialog(vgui::Panel *parent) : Frame(parent, "CServerBrowserDialog")
|
CServerBrowserDialog::CServerBrowserDialog(vgui::Panel *parent) : Frame(parent, "CServerBrowserDialog")
|
||||||
{
|
{
|
||||||
|
SetProportional( NeedProportional() );
|
||||||
s_InternetDlg = this;
|
s_InternetDlg = this;
|
||||||
|
|
||||||
m_szGameName[0] = 0;
|
m_szGameName[0] = 0;
|
||||||
@ -67,19 +68,25 @@ CServerBrowserDialog::CServerBrowserDialog(vgui::Panel *parent) : Frame(parent,
|
|||||||
m_pFilterData = NULL;
|
m_pFilterData = NULL;
|
||||||
m_pFavorites = NULL;
|
m_pFavorites = NULL;
|
||||||
m_pHistory = NULL;
|
m_pHistory = NULL;
|
||||||
|
m_pLanGames = NULL;
|
||||||
|
|
||||||
LoadUserData();
|
LoadUserData();
|
||||||
|
|
||||||
m_pInternetGames = new CInternetGames(this);
|
m_pInternetGames = new CInternetGames(this);
|
||||||
|
/*
|
||||||
m_pFavorites = new CFavoriteGames(this);
|
m_pFavorites = new CFavoriteGames(this);
|
||||||
m_pHistory = new CHistoryGames(this);
|
m_pHistory = new CHistoryGames(this);
|
||||||
|
m_pSpectateGames = new CSpectateGames(this);
|
||||||
// TODO(nillerusr): implement spectate games without steam
|
|
||||||
//m_pSpectateGames = new CSpectateGames(this);
|
|
||||||
m_pLanGames = new CLanGames(this);
|
m_pLanGames = new CLanGames(this);
|
||||||
|
*/
|
||||||
|
|
||||||
SetMinimumSize( 640, 384 );
|
int w = 640; int h = 384;
|
||||||
SetSize( 640, 384 );
|
|
||||||
|
w = IsProportional() ? vgui::scheme()->GetProportionalScaledValue(w) : w;
|
||||||
|
h = IsProportional() ? vgui::scheme()->GetProportionalScaledValue(h) : h;
|
||||||
|
|
||||||
|
SetMinimumSize( w, h );
|
||||||
|
SetSize( w, h );
|
||||||
|
|
||||||
m_pGameList = m_pInternetGames;
|
m_pGameList = m_pInternetGames;
|
||||||
|
|
||||||
@ -89,10 +96,10 @@ CServerBrowserDialog::CServerBrowserDialog(vgui::Panel *parent) : Frame(parent,
|
|||||||
m_pTabPanel = new PropertySheet(this, "GameTabs");
|
m_pTabPanel = new PropertySheet(this, "GameTabs");
|
||||||
m_pTabPanel->SetTabWidth(72);
|
m_pTabPanel->SetTabWidth(72);
|
||||||
m_pTabPanel->AddPage(m_pInternetGames, "#ServerBrowser_InternetTab");
|
m_pTabPanel->AddPage(m_pInternetGames, "#ServerBrowser_InternetTab");
|
||||||
m_pTabPanel->AddPage(m_pFavorites, "#ServerBrowser_FavoritesTab");
|
//m_pTabPanel->AddPage(m_pFavorites, "#ServerBrowser_FavoritesTab");
|
||||||
m_pTabPanel->AddPage(m_pHistory, "#ServerBrowser_HistoryTab");
|
//m_pTabPanel->AddPage(m_pHistory, "#ServerBrowser_HistoryTab");
|
||||||
//m_pTabPanel->AddPage(m_pSpectateGames, "#ServerBrowser_SpectateTab");
|
//m_pTabPanel->AddPage(m_pSpectateGames, "#ServerBrowser_SpectateTab");
|
||||||
m_pTabPanel->AddPage(m_pLanGames, "#ServerBrowser_LanTab");
|
//m_pTabPanel->AddPage(m_pLanGames, "#ServerBrowser_LanTab");
|
||||||
|
|
||||||
m_pTabPanel->AddActionSignalTarget(this);
|
m_pTabPanel->AddActionSignalTarget(this);
|
||||||
|
|
||||||
@ -109,7 +116,7 @@ CServerBrowserDialog::CServerBrowserDialog(vgui::Panel *parent) : Frame(parent,
|
|||||||
{
|
{
|
||||||
m_pTabPanel->SetActivePage(m_pSpectateGames);
|
m_pTabPanel->SetActivePage(m_pSpectateGames);
|
||||||
}
|
}
|
||||||
else */
|
else
|
||||||
if (!Q_stricmp(gameList, "favorites"))
|
if (!Q_stricmp(gameList, "favorites"))
|
||||||
{
|
{
|
||||||
m_pTabPanel->SetActivePage(m_pFavorites);
|
m_pTabPanel->SetActivePage(m_pFavorites);
|
||||||
@ -122,7 +129,7 @@ CServerBrowserDialog::CServerBrowserDialog(vgui::Panel *parent) : Frame(parent,
|
|||||||
{
|
{
|
||||||
m_pTabPanel->SetActivePage(m_pLanGames);
|
m_pTabPanel->SetActivePage(m_pLanGames);
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
{
|
{
|
||||||
m_pTabPanel->SetActivePage(m_pInternetGames);
|
m_pTabPanel->SetActivePage(m_pInternetGames);
|
||||||
}
|
}
|
||||||
@ -160,7 +167,7 @@ void CServerBrowserDialog::Initialize()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: returns a server in the list
|
// Purpose: returns a server in the list
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
gameserveritem_t *CServerBrowserDialog::GetServer( unsigned int serverID )
|
newgameserver_t *CServerBrowserDialog::GetServer( unsigned int serverID )
|
||||||
{
|
{
|
||||||
if (m_pGameList)
|
if (m_pGameList)
|
||||||
return m_pGameList->GetServer( serverID );
|
return m_pGameList->GetServer( serverID );
|
||||||
@ -257,7 +264,7 @@ void CServerBrowserDialog::SaveUserData()
|
|||||||
{
|
{
|
||||||
m_pSavedData->SetString("GameList", "spectate");
|
m_pSavedData->SetString("GameList", "spectate");
|
||||||
}
|
}
|
||||||
else */
|
else
|
||||||
if (m_pGameList == m_pFavorites)
|
if (m_pGameList == m_pFavorites)
|
||||||
{
|
{
|
||||||
m_pSavedData->SetString("GameList", "favorites");
|
m_pSavedData->SetString("GameList", "favorites");
|
||||||
@ -270,7 +277,7 @@ void CServerBrowserDialog::SaveUserData()
|
|||||||
{
|
{
|
||||||
m_pSavedData->SetString("GameList", "history");
|
m_pSavedData->SetString("GameList", "history");
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
{
|
{
|
||||||
m_pSavedData->SetString("GameList", "internet");
|
m_pSavedData->SetString("GameList", "internet");
|
||||||
}
|
}
|
||||||
@ -363,9 +370,9 @@ CServerBrowserDialog *CServerBrowserDialog::GetInstance()
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Adds a server to the list of favorites
|
// Purpose: Adds a server to the list of favorites
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void CServerBrowserDialog::AddServerToFavorites(gameserveritem_t &server)
|
void CServerBrowserDialog::AddServerToFavorites(newgameserver_t &server)
|
||||||
{
|
{
|
||||||
if ( steamapicontext->SteamMatchmaking() )
|
/* if ( steamapicontext->SteamMatchmaking() )
|
||||||
{
|
{
|
||||||
steamapicontext->SteamMatchmaking()->AddFavoriteGame(
|
steamapicontext->SteamMatchmaking()->AddFavoriteGame(
|
||||||
server.m_nAppID,
|
server.m_nAppID,
|
||||||
@ -374,7 +381,7 @@ void CServerBrowserDialog::AddServerToFavorites(gameserveritem_t &server)
|
|||||||
server.m_NetAdr.GetQueryPort(),
|
server.m_NetAdr.GetQueryPort(),
|
||||||
k_unFavoriteFlagFavorite,
|
k_unFavoriteFlagFavorite,
|
||||||
time( NULL ) );
|
time( NULL ) );
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -527,10 +534,10 @@ void CServerBrowserDialog::OnActiveGameName( KeyValues *pKV )
|
|||||||
void CServerBrowserDialog::ReloadFilterSettings()
|
void CServerBrowserDialog::ReloadFilterSettings()
|
||||||
{
|
{
|
||||||
m_pInternetGames->LoadFilterSettings();
|
m_pInternetGames->LoadFilterSettings();
|
||||||
//m_pSpectateGames->LoadFilterSettings();
|
/*m_pSpectateGames->LoadFilterSettings();
|
||||||
m_pFavorites->LoadFilterSettings();
|
m_pFavorites->LoadFilterSettings();
|
||||||
m_pLanGames->LoadFilterSettings();
|
m_pLanGames->LoadFilterSettings();
|
||||||
m_pHistory->LoadFilterSettings();
|
m_pHistory->LoadFilterSettings();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -572,7 +579,7 @@ void CServerBrowserDialog::OnConnectToGame( KeyValues *pMessageValues )
|
|||||||
}
|
}
|
||||||
|
|
||||||
// forward to favorites
|
// forward to favorites
|
||||||
m_pFavorites->OnConnectToGame();
|
//m_pFavorites->OnConnectToGame();
|
||||||
|
|
||||||
m_bCurrentlyConnected = true;
|
m_bCurrentlyConnected = true;
|
||||||
|
|
||||||
@ -582,7 +589,7 @@ void CServerBrowserDialog::OnConnectToGame( KeyValues *pMessageValues )
|
|||||||
{
|
{
|
||||||
iQuickListBitField |= ( 1 << 1 );
|
iQuickListBitField |= ( 1 << 1 );
|
||||||
}
|
}
|
||||||
/* if ( m_pSpectateGames && m_pSpectateGames->IsQuickListButtonChecked() )
|
/*if ( m_pSpectateGames && m_pSpectateGames->IsQuickListButtonChecked() )
|
||||||
{
|
{
|
||||||
iQuickListBitField |= ( 1 << 2 );
|
iQuickListBitField |= ( 1 << 2 );
|
||||||
}*/
|
}*/
|
||||||
@ -625,7 +632,7 @@ void CServerBrowserDialog::OnDisconnectFromGame( void )
|
|||||||
memset( &m_CurrentConnection, 0, sizeof(gameserveritem_t) );
|
memset( &m_CurrentConnection, 0, sizeof(gameserveritem_t) );
|
||||||
|
|
||||||
// forward to favorites
|
// forward to favorites
|
||||||
m_pFavorites->OnDisconnectFromGame();
|
//m_pFavorites->OnDisconnectFromGame();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -634,10 +641,10 @@ void CServerBrowserDialog::OnDisconnectFromGame( void )
|
|||||||
void CServerBrowserDialog::OnLoadingStarted( void )
|
void CServerBrowserDialog::OnLoadingStarted( void )
|
||||||
{
|
{
|
||||||
m_pInternetGames->OnLoadingStarted();
|
m_pInternetGames->OnLoadingStarted();
|
||||||
// m_pSpectateGames->OnLoadingStarted();
|
/* m_pSpectateGames->OnLoadingStarted();
|
||||||
m_pFavorites->OnLoadingStarted();
|
m_pFavorites->OnLoadingStarted();
|
||||||
m_pLanGames->OnLoadingStarted();
|
m_pLanGames->OnLoadingStarted();
|
||||||
m_pHistory->OnLoadingStarted();
|
m_pHistory->OnLoadingStarted();*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
void Open( void );
|
void Open( void );
|
||||||
|
|
||||||
// gets server info
|
// gets server info
|
||||||
gameserveritem_t *GetServer(unsigned int serverID);
|
newgameserver_t *GetServer(unsigned int serverID);
|
||||||
// called every frame
|
// called every frame
|
||||||
virtual void OnTick();
|
virtual void OnTick();
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public:
|
|||||||
static CServerBrowserDialog *GetInstance();
|
static CServerBrowserDialog *GetInstance();
|
||||||
|
|
||||||
// Adds a server to the list of favorites
|
// Adds a server to the list of favorites
|
||||||
void AddServerToFavorites(gameserveritem_t &server);
|
void AddServerToFavorites(newgameserver_t &server);
|
||||||
|
|
||||||
// begins the process of joining a server from a game list
|
// begins the process of joining a server from a game list
|
||||||
// the game info dialog it opens will also update the game list
|
// the game info dialog it opens will also update the game list
|
||||||
@ -118,11 +118,12 @@ private:
|
|||||||
|
|
||||||
// property sheet
|
// property sheet
|
||||||
vgui::PropertySheet *m_pTabPanel;
|
vgui::PropertySheet *m_pTabPanel;
|
||||||
CFavoriteGames *m_pFavorites;
|
|
||||||
CHistoryGames *m_pHistory;
|
|
||||||
CInternetGames *m_pInternetGames;
|
CInternetGames *m_pInternetGames;
|
||||||
//CSpectateGames *m_pSpectateGames;
|
//CSpectateGames *m_pSpectateGames;
|
||||||
CLanGames *m_pLanGames;
|
CLanGames *m_pLanGames;
|
||||||
|
CFavoriteGames *m_pFavorites;
|
||||||
|
CHistoryGames *m_pHistory;
|
||||||
|
|
||||||
KeyValues *m_pSavedData;
|
KeyValues *m_pSavedData;
|
||||||
KeyValues *m_pFilterData;
|
KeyValues *m_pFilterData;
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
|
|
||||||
#include "pch_serverbrowser.h"
|
#include "pch_serverbrowser.h"
|
||||||
|
|
||||||
bool IsReplayServer( gameserveritem_t &server );
|
bool IsReplayServer( newgameserver_t &server );
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: List password column sort function
|
// Purpose: List password column sort function
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl PasswordCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl PasswordCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -37,8 +37,8 @@ int __cdecl PasswordCompare(ListPanel *pPanel, const ListPanelItem &p1, const Li
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl BotsCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl BotsCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -60,21 +60,6 @@ int __cdecl BotsCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPa
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl SecureCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl SecureCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
|
||||||
return -1;
|
|
||||||
if ( !s2 && s1 )
|
|
||||||
return 1;
|
|
||||||
if ( !s1 && !s2 )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if ( s1->m_bSecure < s2->m_bSecure )
|
|
||||||
return 1;
|
|
||||||
else if ( s1->m_bSecure > s2->m_bSecure )
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,8 +68,8 @@ int __cdecl SecureCompare(ListPanel *pPanel, const ListPanelItem &p1, const List
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl IPAddressCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl IPAddressCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -106,8 +91,8 @@ int __cdecl IPAddressCompare(ListPanel *pPanel, const ListPanelItem &p1, const L
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl PingCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl PingCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -132,8 +117,8 @@ int __cdecl PingCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPa
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl MapCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl MapCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -150,8 +135,8 @@ int __cdecl MapCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPan
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl GameCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl GameCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -171,8 +156,8 @@ int __cdecl GameCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPa
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl ServerNameCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl ServerNameCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -181,7 +166,7 @@ int __cdecl ServerNameCompare(ListPanel *pPanel, const ListPanelItem &p1, const
|
|||||||
if ( !s1 && !s2 )
|
if ( !s1 && !s2 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return Q_stricmp( s1->GetName(), s2->GetName() );
|
return Q_stricmp( s1->m_szServerName, s2->m_szServerName );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
@ -189,8 +174,8 @@ int __cdecl ServerNameCompare(ListPanel *pPanel, const ListPanelItem &p1, const
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl PlayersCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl PlayersCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -224,22 +209,6 @@ int __cdecl PlayersCompare(ListPanel *pPanel, const ListPanelItem &p1, const Lis
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl LastPlayedCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl LastPlayedCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer( p1.userData );
|
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer( p2.userData );
|
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
|
||||||
return -1;
|
|
||||||
if ( !s2 && s1 )
|
|
||||||
return 1;
|
|
||||||
if ( !s1 && !s2 )
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// compare number of players
|
|
||||||
if ( s1->m_ulTimeLastPlayed > s2->m_ulTimeLastPlayed )
|
|
||||||
return -1;
|
|
||||||
if ( s1->m_ulTimeLastPlayed < s2->m_ulTimeLastPlayed )
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -248,8 +217,8 @@ int __cdecl LastPlayedCompare(ListPanel *pPanel, const ListPanelItem &p1, const
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl TagsCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl TagsCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
@ -266,8 +235,8 @@ int __cdecl TagsCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPa
|
|||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
int __cdecl ReplayCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
int __cdecl ReplayCompare(ListPanel *pPanel, const ListPanelItem &p1, const ListPanelItem &p2)
|
||||||
{
|
{
|
||||||
gameserveritem_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
newgameserver_t *s1 = ServerBrowserDialog().GetServer(p1.userData);
|
||||||
gameserveritem_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
newgameserver_t *s2 = ServerBrowserDialog().GetServer(p2.userData);
|
||||||
|
|
||||||
if ( !s1 && s2 )
|
if ( !s1 && s2 )
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -20,7 +20,7 @@ class gameserveritem_t;
|
|||||||
#include "FindSteamServers.h"
|
#include "FindSteamServers.h"
|
||||||
#endif
|
#endif
|
||||||
#include "netadr.h"
|
#include "netadr.h"
|
||||||
|
#include "engine/iserversinfo.h"
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ public:
|
|||||||
virtual bool IsRefreshing() = 0;
|
virtual bool IsRefreshing() = 0;
|
||||||
|
|
||||||
// gets information about specified server
|
// gets information about specified server
|
||||||
virtual gameserveritem_t *GetServer(unsigned int serverID) = 0;
|
virtual newgameserver_t *GetServer(unsigned int serverID) = 0;
|
||||||
|
|
||||||
// called when Connect button is pressed
|
// called when Connect button is pressed
|
||||||
virtual void OnBeginConnect() = 0;
|
virtual void OnBeginConnect() = 0;
|
||||||
|
@ -69,7 +69,7 @@
|
|||||||
#include "replay/ienginereplay.h"
|
#include "replay/ienginereplay.h"
|
||||||
|
|
||||||
extern bool GameSupportsReplay();
|
extern bool GameSupportsReplay();
|
||||||
extern bool IsReplayServer( gameserveritem_t &server );
|
extern bool IsReplayServer( newgameserver_t &server );
|
||||||
|
|
||||||
#pragma warning( disable: 4355 ) // warning C4355: 'this' : used in base member initializer list
|
#pragma warning( disable: 4355 ) // warning C4355: 'this' : used in base member initializer list
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user