本文整理汇总了C++中NFDataList::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ NFDataList::GetCount方法的具体用法?C++ NFDataList::GetCount怎么用?C++ NFDataList::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NFDataList
的用法示例。
在下文中一共展示了NFDataList::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetProduceDataCount
bool NFCSLGBuildingModule::GetProduceDataCount( const NFGUID& self, const NFGUID& xBuilID, const std::string& strItemID, int& nCount )
{
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;
}
NFDataList varProduce;
pProduce->FindObject("BuildingGUID", xBuilID, varProduce);
if(varProduce.GetCount() <= 0)
{
nCount = 0;
return true;
}
for (int i = 0; i< varProduce.GetCount(); i++)
{
const std::string& strHasItemID = pProduce->GetString(i, "ItemID");
if (strHasItemID == strItemID)
{
const int nOldCount = pProduce->GetInt(i, "LeftCount");
nCount = pProduce->GetInt(i, "LeftCount");
return true;
}
}
return false;
}
示例2: FindString
int NFCRecord::FindString(const int nCol, const std::string& value, NFDataList& varResult)
{
if (!ValidCol(nCol))
{
return -1;
}
if (TDATA_STRING != mVarRecordType->Type(nCol))
{
return -1;
}
{
for (int i = 0; i < mnMaxRow; ++i)
{
if (!IsUsed(i))
{
continue;
}
const std::string& strData = GetString(i, nCol);
if (0 == strcmp(strData.c_str(), value.c_str()))
{
varResult << (int64_t)i;
}
}
return varResult.GetCount();
}
return -1;
}
示例3: MemberOffline
bool NFCTeamModule::MemberOffline( const NFGUID& self, const NFGUID& xTeam )
{
NF_SHARE_PTR<NFIRecordManager> pRecordManager = m_pCommonRedisModule->GetCacheRecordInfo(xTeam, 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);
pMemberRecord->SetInt(nRow, NFrame::Team::MemberList::Online, 0);
pMemberRecord->SetInt(nRow, NFrame::Team::MemberList::GameID, 0);
return m_pCommonRedisModule->SaveCacheRecordInfo(xTeam, pRecordManager);
}
示例4:
int NFCRecord::FindVector3(const int nCol, const NFVector3& value, NFDataList& varResult)
{
if (!ValidCol(nCol))
{
return -1;
}
if (TDATA_VECTOR3 != mVarRecordType->Type(nCol))
{
return -1;
}
{
for (int i = 0; i < mnMaxRow; ++i)
{
if (!IsUsed(i))
{
continue;
}
if (GetVector3(i, nCol) == value)
{
varResult << (int64_t)i;
}
}
return varResult.GetCount();
}
return -1;
}
示例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: DeleteEquip
bool NFCPackModule::DeleteEquip( const NFGUID& self, const NFGUID& id )
{
if (id.IsNull())
{
return false;
}
NF_SHARE_PTR<NFIObject> pObject = m_pKernelModule->GetObject( self );
if (nullptr == pObject)
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::BagEquipList::ThisName() );
if (nullptr == pRecord)
{
return false;
}
NFDataList varFindResult;
int nFindRowCount = pRecord->FindObject(NFrame::Player::BagEquipList::GUID, id, varFindResult);
if (nFindRowCount > 0)
{
//int nTotalCount = 0;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int32(i);
pRecord->Remove(nFindRow);
}
}
return true;
}
示例7: Boost
int NFCSLGBuildingModule::Boost(const NFGUID& self, const NFGUID& xBuilID)
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, "BuildingList");
if (NULL == pRecord.get())
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "this is no [BuildingList] Record!", "", __FUNCTION__, __LINE__);
return 1;
}
NFDataList var;
pRecord->FindObject("BuildingGUID", xBuilID, var);
if (var.GetCount() <= 0)
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "there are no the building", xBuilID.ToString(), __FUNCTION__, __LINE__);
return 1;
}
const int nRow = var.Int(0);
const int nBoostTime = 20;
const std::string strBuildID = pRecord->GetString(nRow, "BuildingID");
//NFDataList varHeart;
//varHeart << xBuilID;
m_pScheduleModule->AddSchedule(self, "OnBoostHeartBeat", this, &NFCSLGBuildingModule::OnBoostHeartBeat, /*varHeart,*/ nBoostTime, 1);
pRecord->SetInt(nRow, "State", NFMsg::EBS_BOOST);
pRecord->SetInt(nRow, "StateStartTime", pPluginManager->GetNowTime());
pRecord->SetInt(nRow, "StateEndTime", pPluginManager->GetNowTime() + nBoostTime);
return 0;
}
示例8: DestroySceneNPC
bool NFCSceneAOIModule::DestroySceneNPC(const int nSceneID, const int nGroupID)
{
NF_SHARE_PTR<NFCSceneInfo> pSceneInfo = GetElement(nSceneID);
if (pSceneInfo)
{
if (pSceneInfo->GetElement(nGroupID))
{
NFDataList xMonsterlistObject;
if (m_pKernelModule->GetGroupObjectList(nSceneID, nGroupID, xMonsterlistObject, false))
{
for (int i = 0; i < xMonsterlistObject.GetCount(); ++i)
{
NFGUID ident = xMonsterlistObject.Object(i);
m_pKernelModule->DestroyObject(ident);
}
}
pSceneInfo->RemoveElement(nGroupID);
return true;
}
}
return false;
}
示例9: FindFloat
int NFCRecord::FindFloat(const int nCol, const double value, NFDataList& varResult)
{
if (!ValidCol(nCol))
{
return -1;
}
if (TDATA_FLOAT != mVarRecordType->Type(nCol))
{
return -1;
}
for (int i = 0; i < mnMaxRow; ++i)
{
if (!IsUsed(i))
{
continue;
}
if (GetFloat(i, nCol) == value)
{
varResult << i;
}
}
return varResult.GetCount();
}
示例10: 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::BagItemList::ThisName() );
if (!pRecord)
{
return false;
}
NFDataList 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.Int32(i);
int nOldCount = pRecord->GetInt32(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;
}
示例11: Produce
int NFCSLGBuildingModule::Produce(const NFGUID& self, const NFGUID& xBuilID, const std::string& strItemID, const int nCount)
{
NF_SHARE_PTR<NFIRecord> pRecord = m_pKernelModule->FindRecord(self, "BuildingList");
if (NULL == pRecord.get())
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "this is no [BuildingList] Record!", "", __FUNCTION__, __LINE__);
return 1;
}
NFDataList var;
pRecord->FindObject("BuildingGUID", xBuilID, var);
if (var.GetCount() <= 0)
{
m_pLogModule->LogNormal(NFILogModule::NLL_ERROR_NORMAL, self, "there are no the building", xBuilID.ToString(), __FUNCTION__, __LINE__);
return 1;
}
AddProduceData(self, xBuilID, strItemID, nCount);
const std::string strHeartname = GetProduceHeartName(self, xBuilID, strItemID);
const int nTime = 50;//To ADD
if (!m_pScheduleModule->ExistSchedule(self, strHeartname))
{
//NFDataList varHeart;
//varHeart << xBuilID;
//varHeart << strItemID;
m_pScheduleModule->AddSchedule(self, strHeartname, this, &NFCSLGBuildingModule::OnProduceHeartBeat, /*varHeart, */nTime, nCount);
}
return 0;
}
示例12: SendMsgToGame
bool NFCWorldNet_ServerModule::SendMsgToGame(const NFDataList& argObjectVar, const NFDataList& argGameID, const NFMsg::EGameMsgID eMsgID, google::protobuf::Message& xData)
{
if (argGameID.GetCount() != argObjectVar.GetCount())
{
return false;
}
for (int i = 0; i < argObjectVar.GetCount(); i++)
{
const NFGUID& identOther = argObjectVar.Object(i);
const int nGameID = (int) argGameID.Int(i);
SendMsgToGame(nGameID, eMsgID, xData, identOther);
}
return true;
}
示例13: FindRowByColValue
int NFCRecord::FindRowByColValue(const std::string & strColTag, const NFData & var)
{
NFDataList xDataList;
int nRowCount = FindRowByColValue(strColTag, var, xDataList);
if (nRowCount > 0 && xDataList.GetCount() > 0)
{
return (int) xDataList.Int(0);
}
return -1;
}
示例14: EnoughItem
bool NFCPackModule::EnoughItem( 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;
}
bool bExist = m_pElementModule->ExistElement(NFrame::Item::ThisName(), strItemConfigID );
if ( !bExist )
{
return false;
}
NF_SHARE_PTR<NFIRecord> pRecord = pObject->GetRecordManager()->GetElement( NFrame::Player::BagItemList::ThisName() );
if (!pRecord)
{
return false;
}
NFDataList varFindResult;
int nFindRowCount = pRecord->FindString(NFrame::Player::BagItemList::ConfigID, strItemConfigID, varFindResult);
if (nFindRowCount > 0)
{
int nTotalCount = 0;
for (int i = 0; i < varFindResult.GetCount(); ++i)
{
int nFindRow = varFindResult.Int32(i);
int nOldCount = pRecord->GetInt32(nFindRow, NFrame::Player::BagItemList::ItemCount);
nTotalCount += nOldCount;
}
if (nTotalCount > 0)
{
return true;
}
}
return false;
}
示例15: AddProduceData
int NFCSLGBuildingModule::AddProduceData(const NFGUID& self, const NFGUID& xBuilID, const std::string& strItemID, const int nCount)
{
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 1;
}
NFDataList varProduce;
pProduce->FindObject("BuildingGUID", xBuilID, varProduce);
int nFindRow = -1;
for (int i = 0; i< varProduce.GetCount(); i++)
{
const std::string& strHasItemID = pProduce->GetString(i, "ItemID");
if (strHasItemID == strItemID)
{
nFindRow = i;
break;
}
}
if (nFindRow < 0)
{
//already exit
const int nOldCount = pProduce->GetInt(nFindRow, "LeftCount");
pProduce->SetInt(nFindRow, "LeftCount", nOldCount + nCount);
}
else
{
const int nTime = 20;
NFDataList varItem;
varItem << xBuilID;
varItem << strItemID;
varItem << nCount;
varItem << nTime;
varItem << pPluginManager->GetNowTime();
pProduce->AddRow(-1, varItem);
}
return 0;
}