added CSqlPlayerData for simple tasks like getting best time

This commit is contained in:
H-M-H 2016-05-03 23:24:44 +02:00
parent c9e65c7931
commit 94f163f094
2 changed files with 14 additions and 4 deletions

View file

@ -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;

View file

@ -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
{