本文整理汇总了C++中CASW_Player::GetASWNetworkID方法的典型用法代码示例。如果您正苦于以下问题:C++ CASW_Player::GetASWNetworkID方法的具体用法?C++ CASW_Player::GetASWNetworkID怎么用?C++ CASW_Player::GetASWNetworkID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CASW_Player
的用法示例。
在下文中一共展示了CASW_Player::GetASWNetworkID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateLastCommanders
void CASW_Campaign_Save::UpdateLastCommanders()
{
// save which marines the players have selected
// add which marines he has selected
CASW_Game_Resource *pGameResource = ASWGameResource();
if ( !pGameResource )
return;
// first check there were some marines selected (i.e. we're not in the campaign lobby map)
int iNumMarineResources = 0;
for (int i=0;i<pGameResource->GetMaxMarineResources();i++)
{
if (pGameResource->GetMarineResource(i))
iNumMarineResources++;
}
if ( iNumMarineResources <= 0 )
return;
char buffer[256];
for (int i=0;i<ASW_NUM_MARINE_PROFILES;i++)
{
// look for a marine info for this marine
bool bFound = false;
for (int k=0;k<pGameResource->GetMaxMarineResources();k++)
{
CASW_Marine_Resource *pMR = pGameResource->GetMarineResource(k);
if (pMR && pMR->GetProfileIndex() == i && pMR->GetCommander())
{
CASW_Player *pPlayer = pMR->GetCommander();
if (pPlayer)
{
// store the commander who has this marine
Q_snprintf(buffer, sizeof(buffer), "%s%s",pPlayer->GetPlayerName(), pPlayer->GetASWNetworkID());
m_LastCommanders[i] = AllocPooledString(buffer);
m_LastMarineResourceSlot[i] = k;
m_LastPrimaryMarines[i] = pPlayer->IsPrimaryMarine(i);
bFound = true;
break;
}
}
}
if (!bFound)
{
m_LastCommanders[i] = AllocPooledString("");
m_LastMarineResourceSlot[i] = 0;
}
}
}
示例2: SaveGameToFile
//.........这里部分代码省略.........
pSubSection->SetInt("SkillSlot1", m_iMarineSkill[MarineID][ASW_SKILL_SLOT_1]);
pSubSection->SetInt("SkillSlot2", m_iMarineSkill[MarineID][ASW_SKILL_SLOT_2]);
pSubSection->SetInt("SkillSlot3", m_iMarineSkill[MarineID][ASW_SKILL_SLOT_3]);
pSubSection->SetInt("SkillSlot4", m_iMarineSkill[MarineID][ASW_SKILL_SLOT_4]);
pSubSection->SetInt("SkillSlotSpare", m_iMarineSkill[MarineID][ASW_SKILL_SLOT_SPARE]);
pSubSection->SetInt("UndoSkillSlot0", m_iPreviousMarineSkill[MarineID][ASW_SKILL_SLOT_0]);
pSubSection->SetInt("UndoSkillSlot1", m_iPreviousMarineSkill[MarineID][ASW_SKILL_SLOT_1]);
pSubSection->SetInt("UndoSkillSlot2", m_iPreviousMarineSkill[MarineID][ASW_SKILL_SLOT_2]);
pSubSection->SetInt("UndoSkillSlot3", m_iPreviousMarineSkill[MarineID][ASW_SKILL_SLOT_3]);
pSubSection->SetInt("UndoSkillSlot4", m_iPreviousMarineSkill[MarineID][ASW_SKILL_SLOT_4]);
pSubSection->SetInt("UndoSkillSlotSpare", m_iPreviousMarineSkill[MarineID][ASW_SKILL_SLOT_SPARE]);
pSubSection->SetInt("ParasitesKilled", m_iParasitesKilled[MarineID]);
pSubSection->SetString("MissionsCompleted", STRING(m_MissionsCompleteNames[MarineID]));
pSubSection->SetString("Medals", STRING(m_Medals[MarineID]));
int iWound = IsMarineWounded(MarineID) ? 1 : 0;
pSubSection->SetInt("Wounded", iWound);
int iDead = IsMarineAlive(MarineID) ? 0 : 1;
pSubSection->SetInt("Dead", iDead);
pSaveKeyValues->AddSubKey(pSubSection);
}
// check for any new players to add to our list
for ( int i = 1; i <= gpGlobals->maxClients; i++ )
{
CASW_Player* pPlayer = dynamic_cast<CASW_Player*>(UTIL_PlayerByIndex(i));
if ( pPlayer )
{
// first check his network ID
const char *pszNetworkID = pPlayer->GetASWNetworkID();
// check if it's in our list
bool bFound = false;
for (int k=0;k<m_PlayerIDs.Count();k++)
{
const char *p = STRING(m_PlayerIDs[k]);
if (!Q_strcmp(p, pszNetworkID))
bFound = true;
}
if (!bFound)
{
// add it to the list
string_t stringID = AllocPooledString(pszNetworkID);
m_PlayerIDs.AddToTail(stringID);
}
// then check player name
const char *pszPlayerName = pPlayer->GetPlayerName();
bFound = false;
for (int k=0;k<m_PlayerNames.Count();k++)
{
const char *p = STRING(m_PlayerNames[k]);
if (!Q_strcmp(p, pszPlayerName))
bFound = true;
}
if (!bFound)
{
// add it to the list
string_t stringName = AllocPooledString(pszPlayerName);
m_PlayerNames.AddToTail(stringName);
}
}
}