本文整理汇总了C++中CUser::GetSteamID方法的典型用法代码示例。如果您正苦于以下问题:C++ CUser::GetSteamID方法的具体用法?C++ CUser::GetSteamID怎么用?C++ CUser::GetSteamID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CUser
的用法示例。
在下文中一共展示了CUser::GetSteamID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleCallbackClientApprove
void CServerContext::HandleCallbackClientApprove( GSClientApprove_t *pClientApprove )
{
std::cout << "[SERVER] Back-end approved " << pClientApprove->m_SteamID << std::endl;
SteamUserMap::iterator iter = clientSteamMap.find( pClientApprove->m_SteamID );
if( iter != clientSteamMap.end() )
{
CUser *user = iter->second;
std::cout << "[SERVER] User " << *user << " was authed, updating user data." << std::endl;
gameserver->UpdateUserData(user->GetSteamID(), user->GetUsername().c_str(), 0);
gameserveritems->LoadItems(user->GetSteamID());
}
}
示例2: HandleNetClientAuth
void CServerContext::HandleNetClientAuth( SNetSocket_t clientSocket, NetClientAuth_t *pClientAuth )
{
if( clientSocketMap.find( clientSocket ) != clientSocketMap.end() )
{
return;
}
if ( numClients >= MAX_CLIENTS )
{
NetServerConnectionDenied_t denyMsg;
denyMsg.denyReason = EDenyServerFull;
networking->SendDataOnSocket( clientSocket, (void *)&denyMsg, sizeof( denyMsg ), true );
return;
}
uint32 clientIP;
networking->GetSocketInfo( clientSocket, NULL, NULL, &clientIP, NULL );
CSteamID clientSteamID;
EConnectionDenyReason denyReason = EDenyAuthFailed;
bool passedAuth = gameserver->SendUserConnectAndAuthenticate( clientIP, pClientAuth->authTicket, pClientAuth->ticketLen, &clientSteamID );
if( clientSteamMap.find( clientSteamID ) != clientSteamMap.end() )
{
passedAuth = false;
denyReason = EDenySteamIDExists;
}
if ( !passedAuth )
{
NetServerConnectionDenied_t denyMsg;
denyMsg.denyReason = denyReason;
networking->SendDataOnSocket( clientSocket, (void *)&denyMsg, sizeof( denyMsg ), true );
return;
}
CUser *user = new CUser(clientSocket, clientSteamID, pClientAuth->username);
clientSocketMap.insert( SocketUserMap::value_type( clientSocket, user ) );
clientSteamMap.insert( SteamUserMap::value_type( user->GetSteamID(), user ) );
numClients++;
UpdateServerStatus();
std::cout << "[SERVER] " << *user << " connected. Clients: " << numClients << ", Max Clients: " << MAX_CLIENTS << std::endl;
NetServerClientAuthed_t authedMsg;
strcpy( authedMsg.messageOfTheDay, "Welcome to the idler2 test server. Please report any bugs and issues to: VoiDeD @ irc.gamesurge.net / #opensteamworks" );
networking->SendDataOnSocket( clientSocket, (void *)&authedMsg, sizeof( authedMsg ), true );
}