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.

81 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IRUNGAMEENGINE_H
  8. #define IRUNGAMEENGINE_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "interface.h"
  13. #ifdef GetUserName
  14. #undef GetUserName
  15. #endif
  16. //-----------------------------------------------------------------------------
  17. // Purpose: Interface to running the game engine
  18. //-----------------------------------------------------------------------------
  19. abstract_class IRunGameEngine : public IBaseInterface
  20. {
  21. public:
  22. // Returns true if the engine is running, false otherwise.
  23. virtual bool IsRunning() = 0;
  24. // Adds text to the engine command buffer. Only works if IsRunning()
  25. // returns true on success, false on failure
  26. virtual bool AddTextCommand(const char *text) = 0;
  27. // runs the engine with the specified command line parameters. Only works if !IsRunning()
  28. // returns true on success, false on failure
  29. virtual bool RunEngine(const char *gameDir, const char *commandLineParams) = 0;
  30. // returns true if the player is currently connected to a game server
  31. virtual bool IsInGame() = 0;
  32. // gets information about the server the engine is currently connected to
  33. // returns true on success, false on failure
  34. virtual bool GetGameInfo(char *infoBuffer, int bufferSize) = 0;
  35. // tells the engine our userID
  36. virtual void SetTrackerUserID(int trackerID, const char *trackerName) = 0;
  37. // this next section could probably moved to another interface
  38. // iterates users
  39. // returns the number of user
  40. virtual int GetPlayerCount() = 0;
  41. // returns a playerID for a player
  42. // playerIndex is in the range [0, GetPlayerCount)
  43. virtual unsigned int GetPlayerFriendsID(int playerIndex) = 0;
  44. // gets the in-game name of another user, returns NULL if that user doesn't exists
  45. virtual const char *GetPlayerName(int friendsID, char *name, int namelen) = 0;
  46. // gets the friends name of a player
  47. virtual const char *GetPlayerFriendsName(int friendsID, char *name, int namelen) = 0;
  48. // returns the engine build number and mod version string for server versioning
  49. virtual unsigned int GetEngineBuildNumber() = 0;
  50. virtual const char *GetProductVersionString() = 0;
  51. // new interface to RunEngine (done so we don't have to roll the interface version)
  52. virtual bool RunEngine2(const char *gameDir, const char *commandLineParams, bool isSourceGame) = 0;
  53. enum ERunResult
  54. {
  55. k_ERunResultOkay = 0,
  56. k_ERunResultModNotInstalled = 1,
  57. k_ERunResultAppNotFound = 2,
  58. k_ERunResultNotInitialized = 3,
  59. };
  60. virtual ERunResult RunEngine( int iAppID, const char *gameDir, const char *commandLineParams ) = 0;
  61. };
  62. #define RUNGAMEENGINE_INTERFACE_VERSION "RunGameEngine005"
  63. #endif // IRUNGAMEENGINE_H