本文整理汇总了C++中NF_SHARE_PTR::Remove方法的典型用法代码示例。如果您正苦于以下问题:C++ NF_SHARE_PTR::Remove方法的具体用法?C++ NF_SHARE_PTR::Remove怎么用?C++ NF_SHARE_PTR::Remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NF_SHARE_PTR
的用法示例。
在下文中一共展示了NF_SHARE_PTR::Remove方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DeleteItem
bool NFCPackModule::DeleteItem( const NFGUID& self, const std::string& strItemConfigID, const int nCount )
{
if(nCount <= 0)
{
return false;
}
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if ( NULL == pObject )
{
return false;
}
//还得确定有这个装备
if (!m_pElementModule->ExistElement(NFrame::Item::ThisName(), strItemConfigID))
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagItemList() );
if (!pRecord)
{
return false;
}
NFCDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList_ConfigID, strItemConfigID, varFindResult);
if (nFindRowCount > 0)
{
int nNeedDelCount = nCount;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int(i);
int nOldCount = pRecord->GetInt(nFindRow, NFrame::Player::BagItemList_ItemCount);
if (nOldCount > nNeedDelCount)
{
int nNewCount = nOldCount - nNeedDelCount;
pRecord->SetInt(nFindRow, NFrame::Player::BagItemList_ItemCount, nNewCount);
nNeedDelCount = 0;
}
else if (nOldCount == nNeedDelCount)
{
pRecord->Remove(nFindRow);
nNeedDelCount = 0;
}
else if (nOldCount < nNeedDelCount)
{
pRecord->Remove(nFindRow);
nNeedDelCount -= nOldCount;
}
}
if (nNeedDelCount <= 0)
{
return true;
}
}
return false;
}
示例2: DeleteEquip
bool NFCPackModule::DeleteEquip( const NFGUID& self, const NFGUID& id )
{
if (id.IsNull())
{
return false;
}
//删除3个地方,背包,英雄穿戴,玩家穿戴
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if (nullptr == pObject)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::R_BagEquipList() );
if (nullptr == pRecord)
{
return false;
}
NFCDataList varFindResult;
int nFindRowCount = pRecord->FindObject(NFrame::Player::BagItemList_ConfigID, id, varFindResult);
if (nFindRowCount > 0)
{
int nTotalCount = 0;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int(i);
pRecord->Remove(nFindRow);
}
}
return true;
}
示例3: KickGuildMmember
bool NFCGuildModule::KickGuildMmember( const NFGUID& self, const NFGUID& xGuildID, const NFGUID& xMmember )
{
NF_SHARE_PTR<NFIObject> pGuildObject = m_pGuildDataModule->GetGuild(xGuildID);
if (!pGuildObject.get())
{
return false;
}
NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, NFrame::Guild::R_GuildMemberList());
if (!pMemberRecord.get())
{
return false;
}
if (self == xMmember)
{
return false;
}
CheckPower(self, xGuildID, NFMsg::ReqAckOprGuildMember::EGAT_KICK);
NFDataList varList;
pMemberRecord->FindObject(NFrame::Guild::GuildMemberList_GUID, self, varList);
if (varList.GetCount() == 0)
{
return false;
}
const int nRow = varList.Int(0);
pMemberRecord->Remove(nRow);
return true;
}
示例4: LeaveGuild
bool NFCGuildModule::LeaveGuild( const NFGUID& self, const NFGUID& xGuildID )
{
NF_SHARE_PTR<NFIObject> pGuildObject = m_pGuildDataModule->GetGuild(xGuildID);
if (!pGuildObject.get())
{
return false;
}
NF_SHARE_PTR<NFIRecord> pMemberRecord = m_pKernelModule->FindRecord(xGuildID, NFrame::Guild::R_GuildMemberList());
if (!pMemberRecord.get())
{
return false;
}
NFDataList varList;
pMemberRecord->FindObject(NFrame::Guild::GuildMemberList_GUID, self, varList);
if (varList.GetCount() == 0)
{
return false;
}
const int nRow = varList.Int(0);
return pMemberRecord->Remove(nRow);
}
示例5: LeaveTeam
bool NFCTeamModule::LeaveTeam( const NFGUID& self, const NFGUID& xTeamID )
{
NF_SHARE_PTR<NFIRecordManager> pRecordManager = m_pCommonRedisModule->GetCacheRecordInfo(xTeamID, NFrame::Team::ThisName());
if (!pRecordManager)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pMemberRecord = pRecordManager->GetElement(NFrame::Team::MemberList::ThisName());
if (!pMemberRecord.get())
{
return false;
}
NFDataList varList;
pMemberRecord->FindObject(NFrame::Team::MemberList::GUID, self, varList);
if (varList.GetCount() == 0)
{
return false;
}
const int nRow = varList.Int32(0);
if (!pMemberRecord->Remove(nRow))
{
return false;
}
return m_pCommonRedisModule->SaveCacheRecordInfo(xTeamID, pRecordManager);
}
示例6: CheckProduceData
int NFCSLGBuildingModule::CheckProduceData( const NFGUID& self )
{
NF_SHARE_PTR<NFIRecord> pProduce = m_pKernelModule->FindRecord(self, "BuildingProduce");
if (NULL == pProduce.get())
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "this is no [BuildingProduce] Record!", "", __FUNCTION__, __LINE__);
return false;
}
for (int i = 0; i < pProduce->GetRows(); i++)
{
if (!pProduce->IsUsed(i))
{
continue;
}
const int nNowTime = pPluginManager->GetNowTime();
const NFGUID xBuildID = pProduce->GetObject(i, "BuildingGUID");
const std::string strItemID = pProduce->GetString(i, "ItemID");
const int nLeftCount = pProduce->GetInt(i, "LeftCount");
const NFINT64 nLastOnceBeginTime = pProduce->GetInt(i, "OnceStartTime");
const NFINT64 nOnceTime = pProduce->GetInt(i, "OnceTime");
const int nPassTime = nNowTime - nLastOnceBeginTime;
if (nPassTime <= 0)
{
continue;
}
const int nCount = nPassTime/nOnceTime;
if (nCount >= nLeftCount)
{
//add Item
//TO ADD
pProduce->Remove(i);
}
else
{
//add Item
//TO ADD
pProduce->SetInt(i, "", nLeftCount - nCount);
//NFDataList varHeart;
//varHeart << xBuildID;
//varHeart << strItemID;
const std::string strHeartname = GetProduceHeartName(self, xBuildID, strItemID);
const int nTime = (nCount + 1) * nOnceTime - nPassTime;
m_pScheduleModule->AddSchedule(self, strHeartname, this, &NFCSLGBuildingModule::OnProduceHeartBeat, /*varHeart, */nTime, 1);
}
}
return 0;
}
示例7: OnRemoveRow
void NFCRecordLogic::OnRemoveRow(const int nSockIndex, const int nMsgID, const char* msg, const uint32_t nLen)
{
NFGUID nPlayerID;
NFMsg::ObjectRecordRemove xMsg;
if (!NFINetModule::ReceivePB(nSockIndex, nMsgID, msg, nLen, xMsg, nPlayerID))
{
return;
}
NF_SHARE_PTR<NFIObject> object = g_pKernelModule->GetObject(NFINetModule::PBToNF(xMsg.player_id()));
NF_SHARE_PTR<NFIRecordManager> recordMgr = object->GetRecordManager();
for(int i = 0; i < xMsg.remove_row_size(); i++)
{
NF_SHARE_PTR<NFIRecord> record = recordMgr->GetElement(xMsg.record_name());
record->Remove(xMsg.remove_row(i));
}
}
示例8: QuitGroup
bool NFCWorldChatGroupModule::QuitGroup( const NFGUID& self, const NFGUID& xGroupID )
{
NF_SHARE_PTR<NFIObject> pChatGroup = GetGroup(xGroupID);
if (pChatGroup == NULL)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pChatGroup->GetRecordManager()->GetElement("GroupMemberList");
if (pRecord == NULL)
{
return false;
}
NFCDataList varFind;
if (pRecord->FindObject(NFrame::ChatGroup::GroupMemberList_GUID, self, varFind) > 0)
{
pRecord->Remove(varFind);
}
return true;
}