Add Steam Connection state callbacks.

Steam_SteamServersConnected
Steam_SteamServersConnectFailure
Steam_SteamServersDisconnected
This commit is contained in:
KyleSanderson
2014-01-08 03:06:06 -07:00
parent d447369622
commit c2b4217141
2 changed files with 51 additions and 3 deletions
+43 -1
View File
@@ -21,14 +21,23 @@
SteamWorksForwards::SteamWorksForwards() : SteamWorksForwards::SteamWorksForwards() :
m_CallbackGSClientApprove(this, &SteamWorksForwards::OnGSClientApprove), m_CallbackGSClientApprove(this, &SteamWorksForwards::OnGSClientApprove),
m_CallbackValidateTicket(this, &SteamWorksForwards::OnValidateTicket) m_CallbackValidateTicket(this, &SteamWorksForwards::OnValidateTicket),
m_CallbackSteamConnected(this, &SteamWorksForwards::OnSteamServersConnected),
m_CallbackSteamConnectFailure(this, &SteamWorksForwards::OnSteamServersConnectFailure),
m_CallbackSteamDisconnected(this, &SteamWorksForwards::OnSteamServersDisconnected)
{ {
this->pFOVC = forwards->CreateForward("SW_OnValidateClient", ET_Ignore, 2, NULL, Param_Cell, Param_Cell); this->pFOVC = forwards->CreateForward("SW_OnValidateClient", ET_Ignore, 2, NULL, Param_Cell, Param_Cell);
this->pFOSSC = forwards->CreateForward("Steam_SteamServersConnected", ET_Ignore, 0, NULL);
this->pFOSSCF = forwards->CreateForward("Steam_SteamServersConnectFailure", ET_Ignore, 1, NULL, Param_Cell);
this->pFOSSD = forwards->CreateForward("Steam_SteamServersDisconnected", ET_Ignore, 1, NULL, Param_Cell);
} }
SteamWorksForwards::~SteamWorksForwards() SteamWorksForwards::~SteamWorksForwards()
{ {
forwards->ReleaseForward(this->pFOVC); forwards->ReleaseForward(this->pFOVC);
forwards->ReleaseForward(this->pFOSSC);
forwards->ReleaseForward(this->pFOSSCF);
forwards->ReleaseForward(this->pFOSSD);
} }
void SteamWorksForwards::NotifyPawnValidateClient(Account_t parent, Account_t child) void SteamWorksForwards::NotifyPawnValidateClient(Account_t parent, Account_t child)
@@ -52,3 +61,36 @@ void SteamWorksForwards::OnValidateTicket(ValidateAuthTicketResponse_t *pTicket)
{ {
this->NotifyPawnValidateClient(pTicket->m_OwnerSteamID.GetAccountID(), pTicket->m_SteamID.GetAccountID()); this->NotifyPawnValidateClient(pTicket->m_OwnerSteamID.GetAccountID(), pTicket->m_SteamID.GetAccountID());
} }
void SteamWorksForwards::OnSteamServersConnected(SteamServersConnected_t *pResponse)
{
if (this->pFOSSC->GetFunctionCount() == 0)
{
return;
}
this->pFOSSC->Execute(NULL);
}
void SteamWorksForwards::OnSteamServersConnectFailure(SteamServerConnectFailure_t *pResponse)
{
if (this->pFOSSCF->GetFunctionCount() == 0)
{
return;
}
this->pFOSSCF->PushCell(pResponse->m_eResult);
this->pFOSSCF->Execute(NULL);
}
void SteamWorksForwards::OnSteamServersDisconnected(SteamServersDisconnected_t *pResponse)
{
if (this->pFOSSD->GetFunctionCount() == 0)
{
return;
}
this->pFOSSD->PushCell(pResponse->m_eResult);
this->pFOSSD->Execute(NULL);
}
+7 -1
View File
@@ -36,7 +36,13 @@ class SteamWorksForwards
private: private:
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnGSClientApprove, GSClientApprove_t, m_CallbackGSClientApprove); STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnGSClientApprove, GSClientApprove_t, m_CallbackGSClientApprove);
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnValidateTicket, ValidateAuthTicketResponse_t, m_CallbackValidateTicket); STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnValidateTicket, ValidateAuthTicketResponse_t, m_CallbackValidateTicket);
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersConnected, SteamServersConnected_t, m_CallbackSteamConnected);
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersConnectFailure, SteamServerConnectFailure_t, m_CallbackSteamConnectFailure);
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersDisconnected, SteamServersDisconnected_t, m_CallbackSteamDisconnected);
private: private:
IForward *pFOVC; IForward *pFOVC; /* Forward On Validate Client */
IForward *pFOSSC; /* Forward On Steam Servers Connected */
IForward *pFOSSCF; /* Forward On Steam Servers Connect Failure */
IForward *pFOSSD; /* Forward On Steam Servers Disconnected */
}; };