Upgraded clientprefs to use the client serial API (bug 3616)

This commit is contained in:
Matt Woodrow 2009-02-19 19:28:50 +13:00
parent ca3df3bd50
commit f19cb010a0
4 changed files with 11 additions and 11 deletions

View File

@ -205,7 +205,7 @@ void CookieManager::OnClientAuthorized(int client, const char *authstring)
connected[client] = true; connected[client] = true;
TQueryOp *op = new TQueryOp(Query_SelectData, player->GetUserId()); TQueryOp *op = new TQueryOp(Query_SelectData, player->GetSerial());
strcpy(op->m_params.steamId, authstring); strcpy(op->m_params.steamId, authstring);
g_ClientPrefs.AddQueryToQueue(op); g_ClientPrefs.AddQueryToQueue(op);
@ -268,13 +268,13 @@ void CookieManager::OnClientDisconnecting(int client)
} }
} }
void CookieManager::ClientConnectCallback(int userid, IQuery *data) void CookieManager::ClientConnectCallback(int serial, IQuery *data)
{ {
int client; int client;
IResultSet *results; IResultSet *results;
/* Check validity of client */ /* Check validity of client */
if ((client = playerhelpers->GetClientOfUserId(userid)) == 0) if ((client = playerhelpers->GetClientFromSerial(serial)) == 0)
{ {
return; return;
} }

View File

@ -121,7 +121,7 @@ public:
void Unload(); void Unload();
void ClientConnectCallback(int userid, IQuery *data); void ClientConnectCallback(int serial, IQuery *data);
void InsertCookieCallback(Cookie *pCookie, int dbId); void InsertCookieCallback(Cookie *pCookie, int dbId);
void SelectIdCallback(Cookie *pCookie, IQuery *data); void SelectIdCallback(Cookie *pCookie, IQuery *data);

View File

@ -51,7 +51,7 @@ void TQueryOp::RunThinkPart()
case Query_SelectData: case Query_SelectData:
{ {
g_CookieManager.ClientConnectCallback(m_userid, m_pResult); g_CookieManager.ClientConnectCallback(m_serial, m_pResult);
break; break;
} }
@ -84,10 +84,10 @@ void TQueryOp::RunThreadPart()
if (!BindParamsAndRun()) if (!BindParamsAndRun())
{ {
g_pSM->LogError(myself, g_pSM->LogError(myself,
"Failed SQL Query, Error: \"%s\" (Query id %i - userid %i)", "Failed SQL Query, Error: \"%s\" (Query id %i - serial %i)",
m_database->GetError(), m_database->GetError(),
m_type, m_type,
m_userid); m_serial);
} }
m_database->UnlockFromFullAtomicOperation(); m_database->UnlockFromFullAtomicOperation();
@ -115,10 +115,10 @@ void TQueryOp::Destroy()
delete this; delete this;
} }
TQueryOp::TQueryOp(enum querytype type, int userid) TQueryOp::TQueryOp(enum querytype type, int serial)
{ {
m_type = type; m_type = type;
m_userid = userid; m_serial = serial;
m_database = NULL; m_database = NULL;
m_insertId = -1; m_insertId = -1;
m_pResult = NULL; m_pResult = NULL;

View File

@ -68,7 +68,7 @@ struct ParamData
class TQueryOp : public IDBThreadOperation class TQueryOp : public IDBThreadOperation
{ {
public: public:
TQueryOp(enum querytype type, int userid); TQueryOp(enum querytype type, int serial);
TQueryOp(enum querytype type, Cookie *cookie); TQueryOp(enum querytype type, Cookie *cookie);
~TQueryOp() {} ~TQueryOp() {}
@ -102,7 +102,7 @@ private:
enum querytype m_type; enum querytype m_type;
/* Data to be passed to the callback */ /* Data to be passed to the callback */
int m_userid; int m_serial;
int m_insertId; int m_insertId;
Cookie *m_pCookie; Cookie *m_pCookie;
}; };