本文整理汇总了C++中CChar::GetTagDefs方法的典型用法代码示例。如果您正苦于以下问题:C++ CChar::GetTagDefs方法的具体用法?C++ CChar::GetTagDefs怎么用?C++ CChar::GetTagDefs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChar
的用法示例。
在下文中一共展示了CChar::GetTagDefs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeclineEvent
// ---------------------------------------------------------
bool CPartyDef::DeclineEvent( CChar * pCharDecline, CGrayUID uidInviter ) // static
{
ADDTOCALLSTACK("CPartyDef::DeclineEvent");
// This should happen after a timeout as well.
// " You notify %s that you do not wish to join the party"
CChar * pCharInviter = uidInviter.CharFind();
if ( !pCharInviter || !pCharDecline )
return( false );
if ( uidInviter == pCharDecline->GetUID() )
return( false );
CVarDefCont * sTempVal = pCharInviter->GetTagDefs()->GetKey("PARTY_LASTINVITE");
if ( !sTempVal )
return( false );
if ((DWORD)sTempVal->GetValNum() != (DWORD)pCharDecline->GetUID())
return( false );
// Remove the key
pCharInviter->DeleteKey("PARTY_LASTINVITE");
TCHAR * sTemp = Str_GetTemp();
sprintf(sTemp, g_Cfg.GetDefaultMsg(DEFMSG_PARTY_DECLINE_2), static_cast<LPCTSTR>(pCharInviter->GetName()));
pCharDecline->SysMessage( sTemp );
sTemp = Str_GetTemp();
sprintf(sTemp, g_Cfg.GetDefaultMsg(DEFMSG_PARTY_DECLINE_1), static_cast<LPCTSTR>(pCharDecline->GetName()));
pCharInviter->SysMessage( sTemp );
return( true );
}
示例2: AcceptEvent
bool CPartyDef::AcceptEvent( CChar *pCharAccept, CGrayUID uidInviter, bool bForced ) // static
{
ADDTOCALLSTACK("CPartyDef::AcceptEvent");
// We are accepting the invite to join a party
// No security checks if bForced -> true !!!
// Party master is only one that can add ! GetChar(0)
CChar *pCharInviter = uidInviter.CharFind();
if ( !pCharInviter || !pCharInviter->m_pClient || !pCharAccept || !pCharAccept->m_pClient || (pCharInviter == pCharAccept) )
return false;
CPartyDef *pParty = pCharInviter->m_pParty;
if ( !bForced )
{
CVarDefCont *sTempVal = pCharInviter->GetTagDefs()->GetKey("PARTY_LASTINVITE");
if ( !sTempVal || (static_cast<CGrayUID>(sTempVal->GetValNum()) != pCharAccept->GetUID()) )
return false;
pCharInviter->DeleteKey("PARTY_LASTINVITE");
if ( !pCharInviter->CanSee(pCharAccept) )
return false;
}
if ( pCharAccept->m_pParty ) // already in a party
{
if ( pParty == pCharAccept->m_pParty ) // already in this party
return true;
if ( bForced )
{
pCharAccept->m_pParty->RemoveMember(pCharAccept->GetUID(), pCharAccept->GetUID());
pCharAccept->m_pParty = NULL;
}
else
return false;
}
TCHAR *pszMsg = Str_GetTemp();
sprintf(pszMsg, g_Cfg.GetDefaultMsg(DEFMSG_PARTY_JOINED), pCharAccept->GetName());
if ( !pParty )
{
// Create the party now.
pParty = new CPartyDef(pCharInviter, pCharAccept);
ASSERT(pParty);
g_World.m_Parties.InsertHead(pParty);
pCharInviter->SysMessage(pszMsg);
}
else
{
// Add to existing party
if ( pParty->IsPartyFull() || (!bForced && !pParty->IsPartyMaster(pCharInviter)) )
return false;
pParty->SysMessageAll(pszMsg); // tell everyone already in the party about this
pParty->AcceptMember(pCharAccept);
}
pCharAccept->SysMessageDefault(DEFMSG_PARTY_ADDED);
return true;
}