Move CreateCommonCSteamID to SteamWorks.

This commit is contained in:
KyleSanderson
2014-01-12 18:36:42 -07:00
parent 4721f44f98
commit 0c303159a1
3 changed files with 27 additions and 14 deletions
+18
View File
@@ -60,3 +60,21 @@ void SteamWorks::SDK_OnUnload()
delete this->pSWGameServer; delete this->pSWGameServer;
delete this->pSWGameData; delete this->pSWGameData;
} }
CSteamID SteamWorks::CreateCommonCSteamID(uint32_t authid, const cell_t *params, unsigned char universeplace = 2, unsigned char typeplace = 3)
{
EUniverse universe = k_EUniversePublic;
EAccountType type = k_EAccountTypeIndividual;
if (params[0] >= universeplace)
{
universe = static_cast<EUniverse>(params[universeplace]);
}
if (params[0] >= typeplace)
{
type = static_cast<EAccountType>(params[typeplace]);
}
return CSteamID(authid, universe, type);
}
+3
View File
@@ -125,6 +125,9 @@ public:
#endif #endif
//public: /* IClientListener */ //public: /* IClientListener */
//virtual void OnClientDisconnecting(int client); //virtual void OnClientDisconnecting(int client);
public:
CSteamID CreateCommonCSteamID(uint32_t authid, const cell_t *params, unsigned char universeplace, unsigned char typeplace);
public: public:
SteamWorksForwards *pSWForward; SteamWorksForwards *pSWForward;
SteamWorksGameData *pSWGameData; SteamWorksGameData *pSWGameData;
+6 -14
View File
@@ -29,6 +29,11 @@ static ISteamGameServer *GetGSPointer(void)
return g_SteamWorks.pSWGameServer->GetGameServer(); return g_SteamWorks.pSWGameServer->GetGameServer();
} }
static CSteamID CreateCommonCSteamID(uint32_t authid, const cell_t *params, unsigned char universeplace = 2, unsigned char typeplace = 3)
{
return g_SteamWorks.CreateCommonCSteamID(authid, params, universeplace, typeplace);
}
static cell_t sm_IsVACEnabled(IPluginContext *pContext, const cell_t *params) static cell_t sm_IsVACEnabled(IPluginContext *pContext, const cell_t *params)
{ {
ISteamGameServer *pServer = GetGSPointer(); ISteamGameServer *pServer = GetGSPointer();
@@ -166,20 +171,7 @@ static cell_t sm_UserHasLicenseForApp(IPluginContext *pContext, const cell_t *pa
return pContext->ThrowNativeError("Client index %d is invalid", params[1]); return pContext->ThrowNativeError("Client index %d is invalid", params[1]);
} }
EUniverse universe = k_EUniversePublic; CSteamID checkid = CreateCommonCSteamID(pPlayer->GetSteamAccountID(false), params);
EAccountType type = k_EAccountTypeIndividual;
if (params[0] > 2)
{
universe = static_cast<EUniverse>(params[3]);
if (params[0] > 3)
{
type = static_cast<EAccountType>(params[4]);
}
}
CSteamID checkid(pPlayer->GetSteamAccountID(false), universe, type);
return pServer->UserHasLicenseForApp(checkid, params[2]); return pServer->UserHasLicenseForApp(checkid, params[2]);
} }