Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

62 lines
1.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================
  7. #ifndef MODLIST_H
  8. #define MODLIST_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. //-----------------------------------------------------------------------------
  13. // Purpose: Handles parsing of half-life directory for mod info
  14. //-----------------------------------------------------------------------------
  15. class CModList
  16. {
  17. public:
  18. CModList();
  19. int GetIndex( const CGameID &iAppID ) const;
  20. void AddVGUIListener( vgui::VPANEL panel );
  21. // returns number of mods
  22. int ModCount();
  23. // returns the full name of the mod, index valid in range [0, ModCount)
  24. const char *GetModName( int index );
  25. // returns mod directory string
  26. const char *GetModDir( int index );
  27. const CGameID &GetAppID( int index ) const;
  28. // returns the mod name for the associated gamedir
  29. const char *GetModNameForModDir( const CGameID &iAppID );
  30. private:
  31. struct mod_t
  32. {
  33. char description[64];
  34. char gamedir[64];
  35. CGameID m_GameID;
  36. int m_InternalAppId;
  37. bool operator==( const mod_t& rhs ) const { return rhs.m_GameID == m_GameID; }
  38. };
  39. static int ModNameCompare( const mod_t *pLeft, const mod_t *pRight );
  40. void ParseInstalledMods();
  41. void ParseSteamMods();
  42. int LoadAppConfiguration( uint32 nAppID );
  43. CUtlVector<mod_t> m_ModList;
  44. CUtlVector<vgui::VPANEL> m_VGUIListeners;
  45. };
  46. // singleton accessor
  47. extern CModList &ModList();
  48. #endif // MODLIST_H