DDraceNetwork Documentation
Loading...
Searching...
No Matches
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:
43
44 CPlayerData *PlayerData(int Id) { return &m_aPlayerData[Id]; }
45
46 void LoadBestTime();
47 void MapInfo(int ClientId, const char *pMapName);
48 void MapVote(int ClientId, const char *pMapName);
49 void LoadPlayerData(int ClientId, const char *pName = "");
50 void LoadPlayerTimeCp(int ClientId, const char *pName = "");
51 void SaveScore(int ClientId, int TimeTicks, const char *pTimestamp, const float aTimeCp[NUM_CHECKPOINTS], bool NotEligible);
52
53 void SaveTeamScore(int Team, int *pClientIds, unsigned int Size, int TimeTicks, const char *pTimestamp);
54
55 void ShowTop(int ClientId, int Offset = 1);
56 void ShowRank(int ClientId, const char *pName);
57
58 void ShowTeamTop5(int ClientId, int Offset = 1);
59 void ShowPlayerTeamTop5(int ClientId, const char *pName, int Offset = 1);
60 void ShowTeamRank(int ClientId, const char *pName);
61
62 void ShowTopPoints(int ClientId, int Offset = 1);
63 void ShowPoints(int ClientId, const char *pName);
64
65 void ShowTimes(int ClientId, const char *pName, int Offset = 1);
66 void ShowTimes(int ClientId, int Offset = 1);
67
68 void RandomMap(int ClientId, int Stars);
69 void RandomUnfinishedMap(int ClientId, int Stars);
70
71 void SaveTeam(int ClientId, const char *pCode, const char *pServer);
72 void LoadTeam(const char *pCode, int ClientId);
73 void GetSaves(int ClientId);
74};
75
76#endif // GAME_SERVER_SCORE_H
Definition connection_pool.h:61
Definition gamecontext.h:106
Definition scoreworker.h:220
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:289
void ShowRank(int ClientId, const char *pName)
Definition score.cpp:198
void ShowTop(int ClientId, int Offset=1)
Definition score.cpp:212
CPrng m_Prng
Definition score.h:25
void ShowTeamRank(int ClientId, const char *pName)
Definition score.cpp:205
void GetSaves(int ClientId)
Definition score.cpp:394
CPlayerData m_aPlayerData[MAX_CLIENTS]
Definition score.h:16
void LoadTeam(const char *pCode, int ClientId)
Definition score.cpp:342
void ShowTimes(int ClientId, const char *pName, int Offset=1)
Definition score.cpp:240
IServer * Server() const
Definition score.h:20
void RandomUnfinishedMap(int ClientId, int Stars)
Definition score.cpp:275
void ShowPoints(int ClientId, const char *pName)
Definition score.cpp:247
void ShowTeamTop5(int ClientId, int Offset=1)
Definition score.cpp:219
std::shared_ptr< CScorePlayerResult > NewSqlPlayerResult(int ClientId)
Definition score.cpp:22
void ShowPlayerTeamTop5(int ClientId, const char *pName, int Offset=1)
Definition score.cpp:226
void SaveScore(int ClientId, int TimeTicks, const char *pTimestamp, const float aTimeCp[NUM_CHECKPOINTS], bool NotEligible)
Definition score.cpp:147
void LoadPlayerData(int ClientId, const char *pName="")
Definition score.cpp:123
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:31
void SaveTeamScore(int Team, int *pClientIds, unsigned int Size, int TimeTicks, const char *pTimestamp)
Definition score.cpp:172
void ShowTopPoints(int ClientId, int Offset=1)
Definition score.cpp:254
void LoadBestTime()
Definition score.cpp:110
CDbConnectionPool * m_pPool
Definition score.h:17
bool RateLimitPlayer(int ClientId)
Definition score.cpp:51
CPlayerData * PlayerData(int Id)
Definition score.h:44
std::vector< std::string > m_vWordlist
Definition score.h:24
void LoadPlayerTimeCp(int ClientId, const char *pName="")
Definition score.cpp:128
void GeneratePassphrase(char *pBuf, int BufSize)
Definition score.cpp:62
Definition connection.h:19
Definition server.h:31
Definition vmath.h:15
@ MAX_CLIENTS
Definition protocol.h:88
@ NUM_CHECKPOINTS
Definition scoreworker.h:22
Definition connection_pool.h:24
Definition score.cpp:355
Definition score.cpp:426
Definition score.cpp:555