本文整理汇总了C++中poolgroupquestmap::iterator类的典型用法代码示例。如果您正苦于以下问题:C++ iterator类的具体用法?C++ iterator怎么用?C++ iterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了iterator类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveQuestsToDB
void PoolMgr::SaveQuestsToDB()
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
for (PoolGroupQuestMap::iterator itr = mPoolQuestGroups.begin(); itr != mPoolQuestGroups.end(); ++itr)
{
if (itr->isEmpty())
continue;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_POOL_SAVE);
stmt->setUInt32(0, itr->GetPoolId());
trans->Append(stmt);
}
for (SearchMap::iterator itr = mQuestSearchMap.begin(); itr != mQuestSearchMap.end(); ++itr)
{
if (IsSpawnedObject<Quest>(itr->first))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_QUEST_POOL_SAVE);
stmt->setUInt32(0, itr->second);
stmt->setUInt32(1, itr->first);
trans->Append(stmt);
}
}
CharacterDatabase.CommitTransaction(trans);
}
示例2: ChangeDailyQuests
void PoolMgr::ChangeDailyQuests()
{
for (PoolGroupQuestMap::iterator itr = mPoolQuestGroups.begin(); itr != mPoolQuestGroups.end(); ++itr)
{
if (sObjectMgr.GetQuestTemplate(itr->GetFirstEqualChancedObjectId()))
{
UpdatePool<Quest>(itr->GetPoolId(), 1); // anything non-zero means don't load from db
}
}
SaveQuestsToDB();
}
示例3: ChangeWeeklyQuests
void PoolMgr::ChangeWeeklyQuests() {
for (PoolGroupQuestMap::iterator itr = mPoolQuestGroups.begin();
itr != mPoolQuestGroups.end(); ++itr) {
if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(itr->GetFirstEqualChancedObjectId())) {
if (pQuest->IsDaily())
continue;
UpdatePool<Quest>(itr->GetPoolId(), 1);
}
}
SaveQuestsToDB();
}
示例4: ChangeDailyQuests
void PoolMgr::ChangeDailyQuests()
{
for (PoolGroupQuestMap::iterator itr = mPoolQuestGroups.begin(); itr != mPoolQuestGroups.end(); ++itr)
{
if (Quest const* quest = sObjectMgr->GetQuestTemplate(itr->GetFirstEqualChancedObjectId()))
{
if (quest->IsWeekly())
continue;
UpdatePool<Quest>(itr->GetPoolId(), 1); // anything non-zero means don't load from db
}
}
SaveQuestsToDB(true, false, false);
}
示例5: SaveQuestsToDB
void PoolMgr::SaveQuestsToDB()
{
CharacterDatabase.BeginTransaction();
std::ostringstream query;
query << "DELETE FROM pool_quest_save WHERE pool_id IN (";
bool first = true;
for (PoolGroupQuestMap::iterator itr = mPoolQuestGroups.begin(); itr != mPoolQuestGroups.end(); ++itr)
{
if (itr->GetPoolId() != 0)
{
if (!first)
query << ",";
first = false;
query << itr->GetPoolId();
}
}
if (!first)
{
query << ")";
CharacterDatabase.PExecute("%s", query.str().c_str());
}
first = true;
query.rdbuf()->str("");
query << "INSERT INTO pool_quest_save (pool_id, quest_id) VALUES ";
for (SearchMap::iterator itr = mQuestSearchMap.begin(); itr != mQuestSearchMap.end(); ++itr)
{
if (IsSpawnedObject<Quest>(itr->first))
{
if (!first)
query << ",";
first = false;
query << "(" << itr->second << "," << itr->first << ")";
}
}
if (!first)
CharacterDatabase.PExecute("%s", query.str().c_str());
CharacterDatabase.CommitTransaction();
}
示例6: SaveQuestsToDB
void PoolMgr::SaveQuestsToDB(bool daily, bool weekly, bool other)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
// pussywizard: mysql thread races, change only what is meant to be changed
std::set<uint32> deletedPools;
for (PoolGroupQuestMap::iterator itr = mPoolQuestGroups.begin(); itr != mPoolQuestGroups.end(); ++itr)
{
if (itr->isEmpty())
continue;
if (Quest const* quest = sObjectMgr->GetQuestTemplate(itr->GetFirstEqualChancedObjectId()))
{
if (!daily && quest->IsDaily())
continue;
if (!weekly && quest->IsWeekly())
continue;
if (!other && !quest->IsDaily() && !quest->IsWeekly())
continue;
}
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_QUEST_POOL_SAVE);
stmt->setUInt32(0, itr->GetPoolId());
trans->Append(stmt);
deletedPools.insert(itr->GetPoolId());
}
for (SearchMap::iterator itr = mQuestSearchMap.begin(); itr != mQuestSearchMap.end(); ++itr)
if (deletedPools.find(itr->second) != deletedPools.end())
if (IsSpawnedObject<Quest>(itr->first))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_QUEST_POOL_SAVE);
stmt->setUInt32(0, itr->second);
stmt->setUInt32(1, itr->first);
trans->Append(stmt);
}
CharacterDatabase.CommitTransaction(trans);
}