mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
added CSqlPlayerData for simple tasks like getting best time
This commit is contained in:
parent
c9e65c7931
commit
94f163f094
|
@ -119,7 +119,7 @@ bool CSqlScore::Init(CSqlServer* pSqlServer, CSqlData *pGameData, bool HandleFai
|
|||
|
||||
void CSqlScore::CheckBirthday(int ClientID)
|
||||
{
|
||||
CSqlScoreData *Tmp = new CSqlScoreData();
|
||||
CSqlPlayerData *Tmp = new CSqlPlayerData();
|
||||
Tmp->m_ClientID = ClientID;
|
||||
str_copy(Tmp->m_aName, Server()->ClientName(ClientID), MAX_NAME_LENGTH);
|
||||
void *CheckThread = thread_init(ExecSqlFunc, new CSqlExecData(CheckBirthdayThread, Tmp));
|
||||
|
@ -128,7 +128,7 @@ void CSqlScore::CheckBirthday(int ClientID)
|
|||
|
||||
bool CSqlScore::CheckBirthdayThread(CSqlServer* pSqlServer, CSqlData *pGameData, bool HandleFailure)
|
||||
{
|
||||
CSqlScoreData *pData = (CSqlScoreData *)pGameData;
|
||||
CSqlPlayerData *pData = (CSqlPlayerData *)pGameData;
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -168,7 +168,7 @@ bool CSqlScore::CheckBirthdayThread(CSqlServer* pSqlServer, CSqlData *pGameData,
|
|||
|
||||
void CSqlScore::LoadScore(int ClientID)
|
||||
{
|
||||
CSqlScoreData *Tmp = new CSqlScoreData();
|
||||
CSqlPlayerData *Tmp = new CSqlPlayerData();
|
||||
Tmp->m_ClientID = ClientID;
|
||||
str_copy(Tmp->m_aName, Server()->ClientName(ClientID), MAX_NAME_LENGTH);
|
||||
|
||||
|
@ -179,7 +179,7 @@ void CSqlScore::LoadScore(int ClientID)
|
|||
// update stuff
|
||||
bool CSqlScore::LoadScoreThread(CSqlServer* pSqlServer, CSqlData *pGameData, bool HandleFailure)
|
||||
{
|
||||
CSqlScoreData *pData = (CSqlScoreData *)pGameData;
|
||||
CSqlPlayerData *pData = (CSqlPlayerData *)pGameData;
|
||||
|
||||
if (HandleFailure)
|
||||
return true;
|
||||
|
|
|
@ -67,6 +67,16 @@ struct CSqlExecData
|
|||
bool m_ReadOnly;
|
||||
};
|
||||
|
||||
struct CSqlPlayerData : CSqlData
|
||||
{
|
||||
int m_ClientID;
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
char m_aName[16]; // Don't edit this, or all your teeth will fall http://bugs.mysql.com/bug.php?id=50046
|
||||
#else
|
||||
char m_aName[MAX_NAME_LENGTH * 2 - 1];
|
||||
#endif
|
||||
};
|
||||
|
||||
// used for mapvote and mapinfo
|
||||
struct CSqlMapData : CSqlData
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue