本文整理汇总了C++中CSteamID类的典型用法代码示例。如果您正苦于以下问题:C++ CSteamID类的具体用法?C++ CSteamID怎么用?C++ CSteamID使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSteamID类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SteamMatchmaking
void Lobby2Client_Steam_Impl::OnLobbyMatchListCallback( LobbyMatchList_t *pCallback, bool bIOFailure )
{
(void) bIOFailure;
uint32_t i;
for (i=0; i < deferredCallbacks.GetSize(); i++)
{
// Get any instance of Console_SearchRooms
if (deferredCallbacks[i]->GetID()==L2MID_Console_SearchRooms)
{
Console_SearchRooms_Steam *callbackResult = (Console_SearchRooms_Steam *) deferredCallbacks[i];
// iterate the returned lobbies with GetLobbyByIndex(), from values 0 to m_nLobbiesMatching-1
// lobbies are returned in order of closeness to the user, so add them to the list in that order
for ( uint32 iLobby = 0; iLobby < pCallback->m_nLobbiesMatching; iLobby++ )
{
CSteamID steamId = SteamMatchmaking()->GetLobbyByIndex( iLobby );
callbackResult->roomIds.Push(steamId.ConvertToUint64(), _FILE_AND_LINE_ );
RakNet::RakString s = SteamMatchmaking()->GetLobbyData( steamId, "name" );
callbackResult->roomNames.Push(s, _FILE_AND_LINE_ );
}
CallCBWithResultCode(callbackResult, L2RC_SUCCESS);
msgFactory->Dealloc(callbackResult);
deferredCallbacks.RemoveAtIndex(i);
break;
}
}
}
示例2:
//-----------------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------------
uint64 CBaseMultiplayerPlayer::GetSteamIDAsUInt64( void )
{
CSteamID steamIDForPlayer;
if ( GetSteamID( &steamIDForPlayer ) )
return steamIDForPlayer.ConvertToUint64();
return 0;
}
示例3: GenerateUniquePlayerId
void GenerateUniquePlayerId(CSteamAPIContext *pSteamAPIContext)
{
CSHA1 sha1;
// Add the steam name
char szSteamId[256] = "\0";
CSteamID steamid = pSteamAPIContext->SteamUser()->GetSteamID();
V_sprintf_safe(szSteamId, "%u%u%u%u", steamid.GetEUniverse(), steamid.GetEAccountType(), steamid.GetAccountID(), steamid.GetUnAccountInstance());
sha1.Update((unsigned char *)szSteamId, strlen(szSteamId));
// Add some random numbers
char randomNumbers[256] = "\0";
Q_snprintf(randomNumbers, sizeof(randomNumbers), "%i%i%i%i%i%i",
RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000), RandomInt(0, 1000));
sha1.Update((unsigned char *)randomNumbers, strlen(randomNumbers));
// Generate the hash
sha1.Final();
// Compile SHA1 Report
char szReport[1024] = "\0";
sha1.ReportHash(szReport);
// Remove the spaces and make it lowercase
char playerId[1024] = "\0";
Q_StrSubst(szReport, " ", "", playerId, sizeof(playerId));
Q_strlower(playerId);
DevMsg("Generated unique player ID: %s\n", playerId);
ae_uniqueplayerid.SetValue(playerId);
}
示例4: SendUserConnectAndAuthenticate
bool CGameServer::SendUserConnectAndAuthenticate( u32 ipClient, PConstantDataPointer authBlob, u32 authBlobSize, SteamID *steamIDUser )
{
CSteamID idUser;
bool results = gameServer->SendUserConnectAndAuthenticate(ipClient, authBlob, authBlobSize, &idUser);
*steamIDUser = idUser.ConvertToUint64();
return results;
}
示例5: LUA_GetAvatar
static bgfx::TextureHandle* LUA_GetAvatar(lua_State* L, int friend_idx)
{
auto* that = getLuaSteamPlugin(L);
if (!that) return nullptr;
IAllocator& allocator = that->m_engine.getAllocator();
ISteamFriends* friends = SteamFriends();
if (!friends) return nullptr;
CSteamID id = friends->GetFriendByIndex(friend_idx, k_EFriendFlagAll);
auto iter = that->m_avatars.find(id.ConvertToUint64());
if (iter.isValid()) return &iter.value()->handle;
int avatar = friends->GetMediumFriendAvatar(id);
Lumix::u32 w, h;
SteamUtils()->GetImageSize(avatar, &w, &h);
if (w == 0 || h == 0) return nullptr;
Array<Lumix::u8> data(allocator);
data.resize(w * h * 4);
SteamUtils()->GetImageRGBA(avatar, &data[0], w * h * 4);
TextureManager* mng = static_cast<TextureManager*>(that->m_engine.getResourceManager().get(TEXTURE_TYPE));
Texture* tex = LUMIX_NEW(allocator, Texture)(Path("avatar"), *mng, allocator);
tex->create(w, h, &data[0]);
that->m_avatars.insert(id.ConvertToUint64(), tex);
return &tex->handle;
}
示例6: FormatMessage
void CLogger::FormatMessage(wxString& string, CSteamID steamID, const char* cszMessage)
{
wxMutexLocker configLock(m_configLock);
wxArrayString tags, replacements;
tags.Add(_T("{SteamID}")); replacements.Add(wxString(steamID.SteamRender(), wxConvUTF8));
tags.Add(_T("{MySteamID}")); replacements.Add(wxString(m_pSteamUser->GetSteamID().SteamRender(), wxConvUTF8));
tags.Add(_T("{SteamID64}")); replacements.Add(wxString::Format(_T("%llu"), steamID.ConvertToUint64()));
tags.Add(_T("{MySteamID64}")); replacements.Add(wxString::Format(_T("%llu"), m_pSteamUser->GetSteamID().ConvertToUint64()));
tags.Add(_T("{Name}"));
wxString name = wxString(m_pSteamFriends->GetFriendPersonaName(steamID), wxConvUTF8);
const char* cszNickname = NULL;
if(m_pClientFriends && m_pGetPlayerNickname)
cszNickname = m_pGetPlayerNickname(m_pClientFriends, steamID);
if(cszNickname)
{
name += _T(" (") + wxString(cszNickname, wxConvUTF8) + _T(")");
}
replacements.Add(name);
tags.Add(_T("{MyName}")); replacements.Add(wxString(m_pSteamFriends->GetPersonaName(), wxConvUTF8));
tags.Add(_T("{Date}")); replacements.Add(wxDateTime::Now().Format(m_dateFormat));
tags.Add(_T("{Time}")); replacements.Add(wxDateTime::Now().Format(m_timeFormat));
tags.Add(_T("{UnixTime}")); replacements.Add(wxString::Format(_T("%lld"), (long long)wxDateTime::GetTimeNow()));
tags.Add(_T("{NewLine}")); replacements.Add(_T("\n"));
tags.Add(_T("{Tab}")); replacements.Add(_T("\t"));
tags.Add(_T("{Message}")); replacements.Add(wxString(cszMessage, wxConvUTF8));
string = TagsReplace(string, tags, replacements);
}
示例7: GetClanChatMessage
s32 CFriends::GetClanChatMessage(SteamID steamIDClanChat, s32 message, PUtf8String text, s32 textSize,
Enum *chatEntryType, SteamID *sender)
{
CSteamID senderId;
s32 result = friends->GetClanChatMessage(steamIDClanChat, message, text, textSize,
reinterpret_cast<EChatEntryType *>(chatEntryType), &senderId);
*sender = senderId.ConvertToUint64();
return result;
}
示例8:
/* <ee327> ../engine/sv_steam3.cpp:578 */
bool CSteam3Server::NotifyBotConnect(client_t *client)
{
if (client == NULL || !m_bLoggedOn)
return false;
client->network_userid.idtype = AUTH_IDTYPE_LOCAL;
CSteamID steamId = CRehldsPlatformHolder::get()->SteamGameServer()->CreateUnauthenticatedUserConnection();
client->network_userid.m_SteamID = steamId.ConvertToUint64();
return true;
}
示例9: FillPlayerInfo
void FillPlayerInfo(da::protobuf::PlayerInfo* pbPlayerInfo, CDAPlayer* pPlayer)
{
FillProtoBufVector(pbPlayerInfo->mutable_position(), pPlayer->GetAbsOrigin());
pbPlayerInfo->set_health(pPlayer->GetHealth());
pbPlayerInfo->set_flags(GetFlags(pPlayer));
pbPlayerInfo->set_skill(SkillIDToAlias((SkillID)pPlayer->m_Shared.m_iStyleSkill.Get()));
pbPlayerInfo->set_style(pPlayer->GetStylePoints());
pbPlayerInfo->set_total_style(pPlayer->GetTotalStyle());
pbPlayerInfo->set_kills(pPlayer->m_iKills);
pbPlayerInfo->set_deaths(pPlayer->m_iDeaths);
if (pPlayer->GetActiveDAWeapon())
pbPlayerInfo->set_weapon(WeaponIDToAlias(pPlayer->GetActiveDAWeapon()->GetWeaponID()));
if (!pPlayer->IsBot())
{
CSteamID ID;
pPlayer->GetSteamID(&ID);
pbPlayerInfo->set_accountid(ID.GetAccountID());
}
if (DAGameRules()->GetWaypoint(0))
{
pbPlayerInfo->set_waypoint(pPlayer->m_iRaceWaypoint);
FillProtoBufVector(pbPlayerInfo->mutable_objective_position(), DAGameRules()->GetWaypoint(pPlayer->m_iRaceWaypoint)->GetAbsOrigin());
}
if (pPlayer->HasBriefcase())
FillProtoBufVector(pbPlayerInfo->mutable_objective_position(), DAGameRules()->GetCaptureZone()->GetAbsOrigin());
if (pPlayer->m_iSlowMoType == SLOWMO_STYLESKILL)
pbPlayerInfo->set_slowmo_type("super");
else if (pPlayer->m_iSlowMoType == SLOWMO_ACTIVATED)
pbPlayerInfo->set_slowmo_type("active");
else if (pPlayer->m_iSlowMoType == SLOWMO_SUPERFALL)
pbPlayerInfo->set_slowmo_type("superfall");
else if (pPlayer->m_iSlowMoType == SLOWMO_PASSIVE)
pbPlayerInfo->set_slowmo_type("passive");
else if (pPlayer->m_iSlowMoType == SLOWMO_PASSIVE_SUPER)
pbPlayerInfo->set_slowmo_type("passivesuper");
else if (pPlayer->m_iSlowMoType == SLOWMO_NONE)
pbPlayerInfo->set_slowmo_type("none");
else
pbPlayerInfo->set_slowmo_type("unknown");
if (pPlayer->m_flSlowMoTime)
pbPlayerInfo->set_slowmo_seconds(pPlayer->m_flSlowMoTime - gpGlobals->curtime);
else
pbPlayerInfo->set_slowmo_seconds(pPlayer->m_flSlowMoSeconds);
}
示例10: Steam_StringToSteamID
/* <f1e63> ../engine/sv_steam3.cpp:1054 */
uint64 Steam_StringToSteamID(const char *pStr)
{
CSteamID steamID;
if (Steam3Server())
{
CSteamID serverSteamId(Steam3Server()->GetSteamID());
steamID.SetFromSteam2String(pStr, serverSteamId.GetEUniverse());
}
else
{
steamID.SetFromSteam2String(pStr, k_EUniversePublic);
}
return steamID.ConvertToUint64();
}
示例11: CSteamID
SteamAPICall_t CSteamMatchmaking007::CreateLobby( ELobbyType eLobbyType, int )
{
SteamAPICall_t result = CSteamBase::RegisterCall();
LobbyCreated_t* retvals = (LobbyCreated_t*)malloc(sizeof(LobbyCreated_t));
CSteamID id = CSteamID( 1337132, 0x40000, k_EUniversePublic, k_EAccountTypeChat );
retvals->m_eResult = k_EResultOK;
retvals->m_ulSteamIDLobby = id.ConvertToUint64();
CSteamBase::ReturnCall(retvals, sizeof(LobbyCreated_t), LobbyCreated_t::k_iCallback, result);
JoinLobby(id);
return result;
}
示例12: SteamProxy_InitInternal
bool SteamProxy_InitInternal()
{
g_steamProxy.clientFactory = loader.Load();
if (g_steamProxy.clientFactory == NULL)
{
return false;
}
g_steamProxy.steamClient = (ISteamClient008*)g_steamProxy.clientFactory(STEAMCLIENT_INTERFACE_VERSION_008, NULL);
if (g_steamProxy.steamClient == NULL)
{
return false;
}
g_steamProxy.pipe = g_steamProxy.steamClient->CreateSteamPipe();
if (g_steamProxy.pipe == NULL)
{
return false;
}
g_steamProxy.user = g_steamProxy.steamClient->ConnectToGlobalUser(g_steamProxy.pipe);
if (g_steamProxy.user == NULL)
{
return false;
}
ISteamUtils005* steamUtils = (ISteamUtils005*)g_steamProxy.steamClient->GetISteamUtils(g_steamProxy.pipe, STEAMUTILS_INTERFACE_VERSION_005);
int appID = steamUtils->GetAppID();
if (appID == 0)
{
return false;
}
ISteamUser012* steamUser = (ISteamUser012*)g_steamProxy.steamClient->GetISteamUser(g_steamProxy.user, g_steamProxy.pipe, STEAMUSER_INTERFACE_VERSION_012);
CSteamID steamID = steamUser->GetSteamID();
NP_SetExternalSteamID(steamID.ConvertToUint64());
return true;
}
示例13: sizeof
int CSteamUser014::InitiateGameConnection( void *pAuthBlob, int cbMaxAuthBlob, CSteamID steamIDGameServer, uint32 unIPServer, uint16 usPortServer, bool bSecure )
{
if (!NP_GetUserTicket(pAuthBlob, cbMaxAuthBlob, steamIDGameServer.ConvertToUint64()))
{
return 0;
}
return sizeof(NPAuthenticateTicket);
}
示例14: sizeof
SteamAPICall_t CSteamMatchmaking007::JoinLobby( CSteamID steamIDLobby ) {
SteamAPICall_t result = CSteamBase::RegisterCall();
LobbyEnter_t* retvals = (LobbyEnter_t*)malloc(sizeof(LobbyEnter_t));
retvals->m_bLocked = false;
retvals->m_EChatRoomEnterResponse = k_EChatRoomEnterResponseSuccess;
retvals->m_rgfChatPermissions = (EChatPermission)0xFFFFFFFF;
retvals->m_ulSteamIDLobby = steamIDLobby.ConvertToUint64();
CSteamBase::ReturnCall(retvals, sizeof(LobbyEnter_t), LobbyEnter_t::k_iCallback, result);
return result;
}
示例15:
da::protobuf::PlayerList* CDataManager::GetPlayerInList(CDAPlayer* pPlayer)
{
if (pPlayer->IsBot())
return NULL;
CSteamID ID;
pPlayer->GetSteamID(&ID);
if (!ID.IsValid())
return NULL;
if (ID.GetEUniverse() != k_EUniversePublic)
return NULL;
if (ID.GetEAccountType() != k_EAccountTypeIndividual)
return NULL;
CUtlMap<AccountID_t, class da::protobuf::PlayerList*>::IndexType_t it = d->m_apPlayerList.Find(ID.GetAccountID());
if (it == d->m_apPlayerList.InvalidIndex())
{
it = d->m_apPlayerList.Insert(ID.GetAccountID(), new da::protobuf::PlayerList());
da::protobuf::PlayerList* pbPlayerInfo = d->m_apPlayerList[it];
pbPlayerInfo->set_accountid(ID.GetAccountID());
pbPlayerInfo->set_name(pPlayer->GetPlayerName());
}
return d->m_apPlayerList[it];
}