diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /serverbrowser/ModList.cpp | |
| download | archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.tar.xz archived-source-engine-2018-hl2-src-3bf9df6b2785fa6d951086978a3e66f49427166a.zip | |
Diffstat (limited to 'serverbrowser/ModList.cpp')
| -rw-r--r-- | serverbrowser/ModList.cpp | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/serverbrowser/ModList.cpp b/serverbrowser/ModList.cpp new file mode 100644 index 0000000..b95b304 --- /dev/null +++ b/serverbrowser/ModList.cpp @@ -0,0 +1,125 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +//============================================================================= + +#include "pch_serverbrowser.h" + +//----------------------------------------------------------------------------- +// Purpose: Singleton accessor +//----------------------------------------------------------------------------- +CModList &ModList() +{ + static CModList s_ModList; + return s_ModList; +} + +//----------------------------------------------------------------------------- +// Purpose: Constructor +//----------------------------------------------------------------------------- +CModList::CModList() +{ + ParseSteamMods(); +} + +//----------------------------------------------------------------------------- +// Purpose: returns number of mods +//----------------------------------------------------------------------------- +int CModList::ModCount() +{ + return m_ModList.Count(); +} + +//----------------------------------------------------------------------------- +// Purpose: data accessor +//----------------------------------------------------------------------------- +const char *CModList::GetModName(int index) +{ + return m_ModList[index].description; +} + +//----------------------------------------------------------------------------- +// Purpose: data accessor +//----------------------------------------------------------------------------- +const char *CModList::GetModDir(int index) +{ + return m_ModList[index].gamedir; +} + + +//----------------------------------------------------------------------------- +// Purpose: data accessor +//----------------------------------------------------------------------------- +const CGameID &CModList::GetAppID(int index) const +{ + return m_ModList[index].m_GameID; +} + + +//----------------------------------------------------------------------------- +// Purpose: get the modlist index for this app id +//----------------------------------------------------------------------------- +int CModList::GetIndex( const CGameID &iAppID ) const +{ + mod_t mod; + mod.m_GameID = iAppID; + return m_ModList.Find( mod ); +} + + +//----------------------------------------------------------------------------- +// Purpose: returns the mod name for the associated gamedir +//----------------------------------------------------------------------------- +const char *CModList::GetModNameForModDir( const CGameID &gameID ) +{ + int iApp = GetIndex( gameID ); + if ( iApp != m_ModList.InvalidIndex() ) + { + return m_ModList[iApp].description; + } + + if ( ServerBrowserDialog().GetActiveModName() ) + { + return ServerBrowserDialog().GetActiveGameName(); + } + return ""; +} + + +//----------------------------------------------------------------------------- +// Purpose: sort the mod list in alphabetical order +//----------------------------------------------------------------------------- +int CModList::ModNameCompare( const mod_t *pLeft, const mod_t *pRight ) +{ + return ( Q_stricmp( pLeft->description, pRight->description ) ); +} + + +//----------------------------------------------------------------------------- +// Purpose: gets list of steam games we can filter for +//----------------------------------------------------------------------------- +void CModList::ParseSteamMods() +{ + +} + + +//----------------------------------------------------------------------------- +// Purpose: load settings for an app +//----------------------------------------------------------------------------- +int CModList::LoadAppConfiguration( uint32 nAppID ) +{ + + return -1; +} + + +//----------------------------------------------------------------------------- +// Purpose: add a vgui panel to message when the app list changes +//----------------------------------------------------------------------------- +void CModList::AddVGUIListener( vgui::VPANEL panel ) +{ + m_VGUIListeners.AddToTail( panel ); +}
\ No newline at end of file |