本文整理汇总了C++中CreatureGroup::AddMember方法的典型用法代码示例。如果您正苦于以下问题:C++ CreatureGroup::AddMember方法的具体用法?C++ CreatureGroup::AddMember怎么用?C++ CreatureGroup::AddMember使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreatureGroup
的用法示例。
在下文中一共展示了CreatureGroup::AddMember方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddCreatureToGroup
void CreatureGroupManager::AddCreatureToGroup(uint32 groupId,
Creature *member) {
Map *map = member->FindMap();
if (!map)
return;
CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(
groupId);
//Add member to an existing group
if (itr != map->CreatureGroupHolder.end()) {
sLog->outDebug(
LOG_FILTER_UNITS,
"Group found: %u, inserting creature GUID: %u, Group InstanceID %u",
groupId, member->GetGUIDLow(), member->GetInstanceId());
itr->second->AddMember(member);
}
//Create new group
else {
sLog->outDebug(LOG_FILTER_UNITS,
"Group not found: %u. Creating new group.", groupId);
CreatureGroup* group = new CreatureGroup(groupId);
map->CreatureGroupHolder[groupId] = group;
group->AddMember(member);
}
}
示例2: Load
void CreatureGroupsManager::Load()
{
uint32 oldMSTime = WorldTimer::getMSTime();
// Memory leak, but we cannot delete the loaded groups, since pointer may be present at loaded creatures
_groups.clear();
QueryResult* result = WorldDatabase.Query("SELECT leaderGUID, memberGUID, dist, angle, flags FROM creature_groups ORDER BY leaderGUID");
if (!result)
{
sLog.outErrorDb(">> Loaded 0 creature groups. DB table `creature_groups` is empty!");
sLog.outString();
return;
}
uint32 count = 0;
Field *fields;
CreatureGroup *currentGroup = NULL;
do
{
fields = result->Fetch();
//Load group member data
ObjectGuid leaderGuid = ConvertDBGuid(fields[0].GetUInt32());
ObjectGuid memberGuid = ConvertDBGuid(fields[1].GetUInt32());
if (leaderGuid.IsEmpty())
sLog.outErrorDb("CREATURE GROUPS: Bad leader guid %u", fields[0].GetUInt32());
else if (memberGuid.IsEmpty())
sLog.outErrorDb("CREATURE GROUPS: Bad member guid %u", fields[1].GetUInt32());
else
{
if (!currentGroup || leaderGuid != currentGroup->GetLeaderGuid())
{
currentGroup = new CreatureGroup(leaderGuid);
RegisterNewGroup(currentGroup);
}
currentGroup->AddMember(memberGuid, fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetUInt8());
++count;
}
}
while (result->NextRow());
delete result;
sLog.outString(">> Loaded %u creature groups in %u ms", count, WorldTimer::getMSTime() - oldMSTime);
sLog.outString();
}
示例3: AddCreatureToGroup
void FormationMgr::AddCreatureToGroup(ObjectGuid::LowType leaderGuid, Creature* creature)
{
Map* map = creature->FindMap();
if (!map)
return;
CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(leaderGuid);
//Add member to an existing group
if (itr != map->CreatureGroupHolder.end())
{
TC_LOG_DEBUG("entities.unit", "Group found: " UI64FMTD ", inserting %s, Group InstanceID %u", leaderGuid, creature->GetGUID().ToString().c_str(), creature->GetInstanceId());
itr->second->AddMember(creature);
}
//Create new group
else
{
TC_LOG_DEBUG("entities.unit", "Group not found: " UI64FMTD ". Creating new group.", leaderGuid);
CreatureGroup* group = new CreatureGroup(leaderGuid);
map->CreatureGroupHolder[leaderGuid] = group;
group->AddMember(creature);
}
}
示例4: AddCreatureToGroup
void FormationMgr::AddCreatureToGroup(uint32 groupId, Creature* member)
{
Map* map = member->FindMap();
if (!map)
return;
CreatureGroupHolderType::iterator itr = map->CreatureGroupHolder.find(groupId);
//Add member to an existing group
if (itr != map->CreatureGroupHolder.end())
{
TC_LOG_DEBUG("entities.unit", "Group found: %u, inserting creature GUID: %u, Group InstanceID %u", groupId, member->GetGUIDLow(), member->GetInstanceId());
itr->second->AddMember(member);
}
//Create new group
else
{
TC_LOG_DEBUG("entities.unit", "Group not found: %u. Creating new group.", groupId);
CreatureGroup* group = new CreatureGroup(groupId);
map->CreatureGroupHolder[groupId] = group;
group->AddMember(member);
}
}