DDraceNetwork Docs
score.h
Go to the documentation of this file.
1#ifndef GAME_SERVER_SCORE_H
2#define GAME_SERVER_SCORE_H
3
4#include <game/prng.h>
5
6#include "scoreworker.h"
7
9class CGameContext;
10class IDbConnection;
11class IServer;
12struct ISqlData;
13
14class CScore
15{
18
20 IServer *Server() const { return m_pServer; }
23
24 std::vector<std::string> m_vWordlist;
26 void GeneratePassphrase(char *pBuf, int BufSize);
27
28 // returns new SqlResult bound to the player, if no current Thread is active for this player
29 std::shared_ptr<CScorePlayerResult> NewSqlPlayerResult(int ClientId);
30 // Creates for player database requests
32 bool (*pFuncPtr)(IDbConnection *, const ISqlData *, char *pError, int ErrorSize),
33 const char *pThreadName,
34 int ClientId,
35 const char *pName,
36 int Offset);
37
38 // returns true if the player should be rate limited
39 bool RateLimitPlayer(int ClientId);
40
41public:
42 CScore(CGameContext *pGameServer, CDbConnectionPool *pPool);
44
45 CPlayerData *PlayerData(int Id) { return &m_aPlayerData[Id]; }
46
47 void LoadBestTime();
48 void MapInfo(int ClientId, const char *pMapName);
49 void MapVote(int ClientId, const char *pMapName);
50 void LoadPlayerData(int ClientId, const char *pName = "");
51 void LoadPlayerTimeCp(int ClientId, const char *pName = "");
52 void SaveScore(int ClientId, int TimeTicks, const char *pTimestamp, const float aTimeCp[NUM_CHECKPOINTS], bool NotEligible);
53
54 void SaveTeamScore(int Team, int *pClientIds, unsigned int Size, int TimeTicks, const char *pTimestamp);
55
56 void ShowTop(int ClientId, int Offset = 1);
57 void ShowRank(int ClientId, const char *pName);
58
59 void ShowTeamTop5(int ClientId, int Offset = 1);
60 void ShowPlayerTeamTop5(int ClientId, const char *pName, int Offset = 1);
61 void ShowTeamRank(int ClientId, const char *pName);
62
63 void ShowTopPoints(int ClientId, int Offset = 1);
64 void ShowPoints(int ClientId, const char *pName);
65
66 void ShowTimes(int ClientId, const char *pName, int Offset = 1);
67 void ShowTimes(int ClientId, int Offset = 1);
68
69 void RandomMap(int ClientId, int Stars);
70 void RandomUnfinishedMap(int ClientId, int Stars);
71
72 void SaveTeam(int ClientId, const char *pCode, const char *pServer);
73 void LoadTeam(const char *pCode, int ClientId);
74 void GetSaves(int ClientId);
75};
76
77#endif // GAME_SERVER_SCORE_H
Definition: connection_pool.h:61
Definition: gamecontext.h:79
Definition: scoreworker.h:224
Definition: prng.h:7
Definition: score.h:15
CGameContext * GameServer() const
Definition: score.h:19
void SaveTeam(int ClientId, const char *pCode, const char *pServer)
Definition: score.cpp:286
void ShowRank(int ClientId, const char *pName)
Definition: score.cpp:195
void ShowTop(int ClientId, int Offset=1)
Definition: score.cpp:209
CPrng m_Prng
Definition: score.h:25
void MapInfo(int ClientId, const char *pMapName)
Definition: score.cpp:137
void ShowTeamRank(int ClientId, const char *pName)
Definition: score.cpp:202
void GetSaves(int ClientId)
Definition: score.cpp:391
CPlayerData m_aPlayerData[MAX_CLIENTS]
Definition: score.h:16
void LoadTeam(const char *pCode, int ClientId)
Definition: score.cpp:339
void MapVote(int ClientId, const char *pMapName)
Definition: score.cpp:130
CScore(CGameContext *pGameServer, CDbConnectionPool *pPool)
Definition: score.cpp:71
void ShowTimes(int ClientId, const char *pName, int Offset=1)
Definition: score.cpp:237
IServer * Server() const
Definition: score.h:20
void RandomMap(int ClientId, int Stars)
Definition: score.cpp:258
void RandomUnfinishedMap(int ClientId, int Stars)
Definition: score.cpp:272
void ShowPoints(int ClientId, const char *pName)
Definition: score.cpp:244
void ShowTeamTop5(int ClientId, int Offset=1)
Definition: score.cpp:216
std::shared_ptr< CScorePlayerResult > NewSqlPlayerResult(int ClientId)
Definition: score.cpp:19
void ShowPlayerTeamTop5(int ClientId, const char *pName, int Offset=1)
Definition: score.cpp:223
void SaveScore(int ClientId, int TimeTicks, const char *pTimestamp, const float aTimeCp[NUM_CHECKPOINTS], bool NotEligible)
Definition: score.cpp:144
~CScore()
Definition: score.h:43
void LoadPlayerData(int ClientId, const char *pName="")
Definition: score.cpp:120
IServer * m_pServer
Definition: score.h:22
CGameContext * m_pGameServer
Definition: score.h:21
void ExecPlayerThread(bool(*pFuncPtr)(IDbConnection *, const ISqlData *, char *pError, int ErrorSize), const char *pThreadName, int ClientId, const char *pName, int Offset)
Definition: score.cpp:28
void SaveTeamScore(int Team, int *pClientIds, unsigned int Size, int TimeTicks, const char *pTimestamp)
Definition: score.cpp:169
void ShowTopPoints(int ClientId, int Offset=1)
Definition: score.cpp:251
void LoadBestTime()
Definition: score.cpp:107
CDbConnectionPool * m_pPool
Definition: score.h:17
bool RateLimitPlayer(int ClientId)
Definition: score.cpp:48
CPlayerData * PlayerData(int Id)
Definition: score.h:45
std::vector< std::string > m_vWordlist
Definition: score.h:24
void LoadPlayerTimeCp(int ClientId, const char *pName="")
Definition: score.cpp:125
void GeneratePassphrase(char *pBuf, int BufSize)
Definition: score.cpp:59
Definition: connection.h:19
Definition: server.h:30
@ MAX_CLIENTS
Definition: protocol.h:88
@ NUM_CHECKPOINTS
Definition: scoreworker.h:22
Definition: connection_pool.h:24