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.

94 lines
2.4 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose: Interface of CMatchInfo
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //------------------------------------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #pragma warning(disable:4786)
  14. #ifndef MATCHINFO_H
  15. #define MATCHINFO_H
  16. #ifdef WIN32
  17. #pragma once
  18. #endif
  19. #include <map>
  20. #include <string>
  21. #include "EventList.h"
  22. #include "util.h"
  23. #include "player.h"
  24. #include "time.h"
  25. using namespace std;
  26. //------------------------------------------------------------------------------------------------------
  27. // Purpose: CMatchInfo is a collection of data gleaned from the logfile. An
  28. // instance of this class contains info that many different report elements and
  29. // awards use, such as player names, teams, and things like that.
  30. //------------------------------------------------------------------------------------------------------
  31. class CMatchInfo
  32. {
  33. private:
  34. CPlayerList players;
  35. public:
  36. CPlayerListIterator playerBegin(){return players.begin();}
  37. CPlayerListIterator playerEnd(){return players.end();}
  38. CPlayerList& playerList(){return players;}
  39. private:
  40. string teamnames[MAX_TEAMS];
  41. bool team_exists[MAX_TEAMS];
  42. string servername;
  43. string mapname;
  44. int numPlrs;
  45. time_t logclosetime;
  46. time_t logopentime;
  47. CEventList* plogfile;
  48. bool bLanGame;
  49. public:
  50. explicit CMatchInfo(CEventList* plf);
  51. bool isLanGame(){return bLanGame;}
  52. void generate();
  53. CEventList* eventList(){return plogfile;}
  54. int numPlayers(){return numPlrs;}
  55. string mapName(){return mapname;}
  56. char* playerName(PID pid,char* out){if (pid==1) return "PID=-1!"; strcpy(out,players[pid].name.c_str());return out;}
  57. string playerName(PID pid){return pid==-1?string("PID=-1!"):players[pid].name;}
  58. PID getPlayerID(string name);
  59. //unsigned int getPlayerWONID(string name);
  60. //unsigned int getPlayerWONID(PID pid){return players[pid].WONID;}
  61. //int playerTeamID(PID p){return players[p].team;}
  62. string teamName(int TID){return teamnames[TID];}
  63. int teamID(string teamname);
  64. bool teamExists(int tid){return team_exists[tid];}
  65. string getServerName(){return servername;}
  66. time_t getTimeOn(PID pid);
  67. time_t logCloseTime(){return logclosetime;}
  68. time_t logOpenTime(){return logopentime;}
  69. };
  70. extern CMatchInfo* g_pMatchInfo;
  71. #endif // MATCHINFO_H