本文整理汇总了C++中CChar::NPC_PetSetOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ CChar::NPC_PetSetOwner方法的具体用法?C++ CChar::NPC_PetSetOwner怎么用?C++ CChar::NPC_PetSetOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CChar
的用法示例。
在下文中一共展示了CChar::NPC_PetSetOwner方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateNPC
CChar * CChar::Use_Figurine( CItem * pItem, bool bCheckFollowerSlots )
{
ADDTOCALLSTACK("CChar::Use_Figurine");
// NOTE: The figurine is NOT destroyed.
bool bCreatedNewNpc = false;
if ( !pItem )
return NULL;
if ( pItem->m_uidLink.IsValidUID() && pItem->m_uidLink.IsChar() && pItem->m_uidLink != GetUID() && !IsPriv(PRIV_GM) )
{
SysMessageDefault(DEFMSG_MSG_FIGURINE_NOTYOURS);
return NULL;
}
// Create a new NPC if there's no one linked to this figurine
CChar *pPet = pItem->m_itFigurine.m_UID.CharFind();
if ( !pPet )
{
CREID_TYPE id = pItem->m_itFigurine.m_ID;
if ( !id )
{
id = CItemBase::FindCharTrack(pItem->GetID());
if ( !id )
{
DEBUG_ERR(("FIGURINE id 0%x, no creature\n", pItem->GetDispID()));
return NULL;
}
}
bCreatedNewNpc = true;
pPet = CreateNPC(id);
ASSERT(pPet);
pPet->SetName(pItem->GetName());
if ( pItem->GetHue() )
{
pPet->m_prev_Hue = pItem->GetHue();
pPet->SetHue(pItem->GetHue());
}
}
if ( bCheckFollowerSlots && IsSetOF(OF_PetSlots) )
{
if ( !FollowersUpdate(pPet, static_cast<short>(maximum(1, pPet->GetDefNum("FOLLOWERSLOTS", true, true))), true) )
{
SysMessageDefault(DEFMSG_PETSLOTS_TRY_CONTROL);
if ( bCreatedNewNpc )
pPet->Delete();
return NULL;
}
}
if ( pPet->IsDisconnected() )
pPet->StatFlag_Clear(STATF_Ridden); // pull the creature out of IDLE space
pItem->m_itFigurine.m_UID.InitUID();
pPet->m_dirFace = m_dirFace;
pPet->NPC_PetSetOwner(this);
pPet->MoveToChar(pItem->GetTopLevelObj()->GetTopPoint());
pPet->Update();
pPet->Skill_Start(SKILL_NONE); // was NPCACT_RIDDEN
pPet->SoundChar(CRESND_RAND1);
return pPet;
}