本文整理汇总了C++中PetIds::insert方法的典型用法代码示例。如果您正苦于以下问题:C++ PetIds::insert方法的具体用法?C++ PetIds::insert怎么用?C++ PetIds::insert使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PetIds
的用法示例。
在下文中一共展示了PetIds::insert方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadDump
//.........这里部分代码省略.........
{
if (!changenth(line, 1, newguid)) // character_gifts.guid update
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (!changeGuid(line, 2, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
{ ROLLBACK(DUMP_FILE_BROKEN); } // character_gifts.item_guid update
break;
}
case DTT_ITEM_LOOT:
{
// item, owner
if (!changeGuid(line, 1, items, sObjectMgr.m_ItemGuids.GetNextAfterMaxUsed()))
{ ROLLBACK(DUMP_FILE_BROKEN); } // item_loot.guid update
if (!changenth(line, 2, newguid)) // item_Loot.owner_guid update
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
case DTT_PET:
{
// store a map of old pet id to new inserted pet id for use by type 5 tables
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
if (strlen(lastpetid) == 0)
{ snprintf(lastpetid, 20, "%s", currpetid); }
if (strcmp(lastpetid, currpetid) != 0)
{
snprintf(newpetid, 20, "%d", sObjectMgr.GeneratePetNumber());
snprintf(lastpetid, 20, "%s", currpetid);
}
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
if (petids_iter == petids.end())
{
petids.insert(PetIdsPair(atoi(currpetid), atoi(newpetid)));
}
if (!changenth(line, 1, newpetid)) // character_pet.id update
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (!changenth(line, 3, newguid)) // character_pet.owner update
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
case DTT_PET_TABLE: // pet_aura, pet_spell, pet_spell_cooldown
{
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
// lookup currpetid and match to new inserted pet id
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
if (petids_iter == petids.end()) // couldn't find new inserted id
{ ROLLBACK(DUMP_FILE_BROKEN); }
snprintf(newpetid, 20, "%d", petids_iter->second);
if (!changenth(line, 1, newpetid)) // pet_*.guid -> petid in fact
{ ROLLBACK(DUMP_FILE_BROKEN); }
break;
}
case DTT_MAIL: // mail
{
if (!changeGuid(line, 1, mails, sObjectMgr.m_MailIds.GetNextAfterMaxUsed()))
{ ROLLBACK(DUMP_FILE_BROKEN); } // mail.id update
if (!changenth(line, 6, newguid)) // mail.receiver update
{ ROLLBACK(DUMP_FILE_BROKEN); }
if (!changeGuid(line, 8, itemTexts, sObjectMgr.m_ItemTextIds.GetNextAfterMaxUsed()))
示例2: LoadDump
//.........这里部分代码省略.........
std::string vals = getnth(line,3);
if(!changetokGuid(vals, OBJECT_FIELD_GUID+1, items, objmgr.m_hiItemGuid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changetoknth(vals, ITEM_FIELD_OWNER+1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changenth(line, 3, vals.c_str()))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_ITEM_GIFT: // character_gift
{
// guid,item_guid,
if(!changenth(line, 1, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changeGuid(line, 2, items, objmgr.m_hiItemGuid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_PET: // character_pet t
{
//store a map of old pet id to new inserted pet id for use by type 5 tables
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
if(strlen(lastpetid)==0) snprintf(lastpetid, 20, "%s", currpetid);
if(strcmp(lastpetid,currpetid)!=0)
{
snprintf(newpetid, 20, "%d", objmgr.GeneratePetNumber());
snprintf(lastpetid, 20, "%s", currpetid);
}
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
if(petids_iter == petids.end())
{
petids.insert(PetIdsPair(atoi(currpetid), atoi(newpetid)));
}
// item, entry, owner, ...
if(!changenth(line, 1, newpetid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changenth(line, 3, newguid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_PET_TABLE: // pet_aura, pet_spell, pet_spell_cooldown t
{
snprintf(currpetid, 20, "%s", getnth(line, 1).c_str());
// lookup currpetid and match to new inserted pet id
std::map<uint32, uint32> :: const_iterator petids_iter = petids.find(atoi(currpetid));
if(petids_iter == petids.end()) // couldn't find new inserted id
ROLLBACK(DUMP_FILE_BROKEN);
snprintf(newpetid, 20, "%d", petids_iter->second);
if(!changenth(line, 1, newpetid))
ROLLBACK(DUMP_FILE_BROKEN);
break;
}
case DTT_MAIL: // mail
{
// id,messageType,stationery,sender,receiver
if(!changeGuid(line, 1, mails, objmgr.m_mailid))
ROLLBACK(DUMP_FILE_BROKEN);
if(!changenth(line, 5, newguid))