当前位置: 首页>>代码示例>>C++>>正文


C++ CUser::GetSteamID方法代码示例

本文整理汇总了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());
	}
}
开发者ID:Call-of-Duty-Scripts,项目名称:TeknoMW3,代码行数:14,代码来源:CServerContext.cpp

示例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 );
}
开发者ID:Call-of-Duty-Scripts,项目名称:TeknoMW3,代码行数:54,代码来源:CServerContext.cpp


注:本文中的CUser::GetSteamID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。