2018-07-06 14:11:38 +00:00
|
|
|
#ifndef GAME_SERVER_SCORE_H
|
|
|
|
#define GAME_SERVER_SCORE_H
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2019-05-19 22:12:59 +00:00
|
|
|
#include <memory>
|
2020-05-26 21:22:16 +00:00
|
|
|
#include <atomic>
|
2019-05-19 22:12:59 +00:00
|
|
|
|
2020-05-26 21:22:16 +00:00
|
|
|
#include "save.h"
|
2010-08-20 17:45:09 +00:00
|
|
|
|
2019-04-02 17:53:37 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
NUM_CHECKPOINTS = 25,
|
|
|
|
TIMESTAMP_STR_LENGTH = 20, // 2019-04-02 19:38:36
|
|
|
|
};
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2010-08-23 19:37:27 +00:00
|
|
|
class CPlayerData
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
|
|
|
public:
|
2010-08-23 19:37:27 +00:00
|
|
|
CPlayerData()
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
}
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2010-08-23 19:37:27 +00:00
|
|
|
void Reset()
|
|
|
|
{
|
|
|
|
m_BestTime = 0;
|
|
|
|
m_CurrentTime = 0;
|
2010-11-04 18:10:51 +00:00
|
|
|
for(int i = 0; i < NUM_CHECKPOINTS; i++)
|
2010-08-23 19:37:27 +00:00
|
|
|
m_aBestCpTime[i] = 0;
|
|
|
|
}
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2010-11-04 18:10:51 +00:00
|
|
|
void Set(float Time, float CpTime[NUM_CHECKPOINTS])
|
2010-08-23 19:37:27 +00:00
|
|
|
{
|
|
|
|
m_BestTime = Time;
|
2010-11-04 18:10:51 +00:00
|
|
|
for(int i = 0; i < NUM_CHECKPOINTS; i++)
|
2010-08-23 19:37:27 +00:00
|
|
|
m_aBestCpTime[i] = CpTime[i];
|
|
|
|
}
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2010-08-23 19:37:27 +00:00
|
|
|
float m_BestTime;
|
|
|
|
float m_CurrentTime;
|
2010-11-04 18:10:51 +00:00
|
|
|
float m_aBestCpTime[NUM_CHECKPOINTS];
|
2010-07-29 05:21:18 +00:00
|
|
|
};
|
|
|
|
|
2020-05-26 21:22:16 +00:00
|
|
|
struct CRandomMapResult
|
2019-05-19 22:12:59 +00:00
|
|
|
{
|
|
|
|
char m_aMap[64];
|
|
|
|
};
|
|
|
|
|
2020-05-26 21:22:16 +00:00
|
|
|
struct CMapVoteResult
|
2019-06-25 19:03:15 +00:00
|
|
|
{
|
|
|
|
char m_aMap[64];
|
|
|
|
char m_aServer[32];
|
|
|
|
};
|
|
|
|
|
2010-08-23 19:37:27 +00:00
|
|
|
class IScore
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2010-08-23 19:37:27 +00:00
|
|
|
CPlayerData m_aPlayerData[MAX_CLIENTS];
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2010-07-29 05:21:18 +00:00
|
|
|
public:
|
2010-08-23 19:37:27 +00:00
|
|
|
virtual ~IScore() {}
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2010-08-23 19:37:27 +00:00
|
|
|
CPlayerData *PlayerData(int ID) { return &m_aPlayerData[ID]; }
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2017-11-23 14:47:38 +00:00
|
|
|
virtual void MapInfo(int ClientID, const char *pMapName) = 0;
|
2020-05-28 13:29:14 +00:00
|
|
|
virtual void MapVote(int ClientID, const char *pMapName) = 0;
|
2016-03-25 23:20:18 +00:00
|
|
|
virtual void CheckBirthday(int ClientID) = 0;
|
2010-08-23 19:37:27 +00:00
|
|
|
virtual void LoadScore(int ClientID) = 0;
|
2019-04-02 17:53:37 +00:00
|
|
|
virtual void SaveScore(int ClientID, float Time, const char *pTimestamp, float aCpTime[NUM_CHECKPOINTS], bool NotEligible) = 0;
|
2013-07-21 06:46:52 +00:00
|
|
|
|
2019-04-02 17:53:37 +00:00
|
|
|
virtual void SaveTeamScore(int *pClientIDs, unsigned int Size, float Time, const char *pTimestamp) = 0;
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2020-05-28 15:56:32 +00:00
|
|
|
virtual void ShowTop5(int ClientID, void *pUserData, int Offset=1) = 0;
|
2020-05-28 15:48:34 +00:00
|
|
|
virtual void ShowRank(int ClientID, const char *pName) = 0;
|
2013-07-21 02:52:23 +00:00
|
|
|
|
2020-05-28 15:56:32 +00:00
|
|
|
virtual void ShowTeamTop5(int ClientID, void *pUserData, int Offset=1) = 0;
|
2020-05-28 15:48:34 +00:00
|
|
|
virtual void ShowTeamRank(int ClientID, const char *pName) = 0;
|
2013-07-21 06:46:52 +00:00
|
|
|
|
2020-05-28 15:56:32 +00:00
|
|
|
virtual void ShowTopPoints(int ClientID, void *pUserData, int Offset=1) = 0;
|
2020-05-28 15:48:34 +00:00
|
|
|
virtual void ShowPoints(int ClientID, const char *pName) = 0;
|
2014-06-20 20:40:23 +00:00
|
|
|
|
2020-05-26 21:22:16 +00:00
|
|
|
virtual void RandomMap(int ClientID, int Stars) = 0;
|
2020-05-28 13:29:14 +00:00
|
|
|
virtual void RandomUnfinishedMap(int ClientID, int Stars) = 0;
|
2014-10-10 23:01:32 +00:00
|
|
|
|
2017-03-21 10:24:44 +00:00
|
|
|
virtual void SaveTeam(int Team, const char *pCode, int ClientID, const char *pServer) = 0;
|
|
|
|
virtual void LoadTeam(const char *pCode, int ClientID) = 0;
|
2020-05-23 17:01:19 +00:00
|
|
|
virtual void GetSaves(int ClientID) = 0;
|
2016-05-04 13:32:24 +00:00
|
|
|
|
|
|
|
// called when the server is shut down but not on mapchange/reload
|
|
|
|
virtual void OnShutdown() = 0;
|
2010-07-29 05:21:18 +00:00
|
|
|
};
|
|
|
|
|
2018-07-06 14:11:38 +00:00
|
|
|
#endif // GAME_SERVER_SCORE_H
|