本文整理汇总了C++中PlayerPointer::SetInstanceID方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerPointer::SetInstanceID方法的具体用法?C++ PlayerPointer::SetInstanceID怎么用?C++ PlayerPointer::SetInstanceID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerPointer
的用法示例。
在下文中一共展示了PlayerPointer::SetInstanceID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PreTeleport
//.........这里部分代码省略.........
if( PlayerOwnsInstance( inn, plr ) >= OWNER_CHECK_OK )
{
m_mapLock.Release();
return INSTANCE_OK;
}
}
//There are no active maps, re-check if this concerns a saved instance.
Instance * saved_in = sInstanceMgr.GetSavedInstance( mapid, plr->GetLowGUID() );
if( saved_in && saved_in->m_instanceId == instanceid )
{
if ( PlayerOwnsInstance( saved_in, plr ) >= OWNER_CHECK_OK )
{
m_mapLock.Release();
return INSTANCE_OK;
}
}
m_mapLock.Release();
return INSTANCE_ABORT_NOT_FOUND;
}
else
{
// search all active instances and see if we have one here.
for(itr = instancemap->begin(); itr != instancemap->end();)
{
in = itr->second;
++itr;
if(PlayerOwnsInstance(in, plr) >= OWNER_CHECK_OK )
{
m_mapLock.Release();
// check the player count and in combat status.
if(in->m_mapMgr && in->m_mapMgr->HasPlayers() && !plr->triggerpass_cheat)
{
if( in->m_mapMgr->IsCombatInProgress())
return INSTANCE_ABORT_ENCOUNTER;
// check if we are full
if( in->m_mapMgr->GetPlayerCount() >= inf->playerlimit )
return INSTANCE_ABORT_FULL;
}
// found our instance, allow him in.
return INSTANCE_OK;
}
else
DEBUG_LOG("InstanceMgr","Check failed %s",plr->GetName());
}
}
}
else
{
if(instanceid != 0)
{
return INSTANCE_ABORT_NOT_FOUND;
}
// gotta create the hashmap.
m_instances[mapid] = new InstanceMap;
instancemap = m_instances[mapid];
}
// if we're here, it means we need to create a new instance.
in = new Instance;
in->m_creation = UNIXTIME;
in->m_expiration = (inf->type == INSTANCE_NONRAID) ? 0 : UNIXTIME + inf->cooldown; // expire time 0 is 10 minutes after last player leaves
in->m_creatorGuid = pGroup ? 0 : plr->GetLowGUID(); // creator guid is 0 if its owned by a group.
in->m_creatorGroup = pGroup ? pGroup->GetID() : 0;
in->m_difficulty = plr->iInstanceType;
in->m_instanceId = GenerateInstanceID();
in->m_mapId = mapid;
in->m_mapMgr = NULLMAPMGR; // always start off without a map manager, it is created in GetInstance()
//crash fix; GM's without group will start up raid instances as if they where nonraids
//this to avoid exipring check, this is mainly for developers purpose; GM's should NOT invite any players here!
if( plr->triggerpass_cheat && !plr->GetGroup() && inf->type == INSTANCE_RAID)
{
inf->type = INSTANCE_NONRAID;
sGMLog.writefromsession(plr->GetSession(), "Started a raid instance %d [%s] as non_raid instance.", mapid, inf->name);
DEBUG_LOG("InstanceMgr","Started a raid instance %d [%s] as non_raid instance.", mapid, inf->name);
}
in->m_mapInfo = inf;
in->m_isBattleground=false;
plr->SetInstanceID(in->m_instanceId);
if( plr->GetGroup() && !plr->GetSession()->HasGMPermissions())//GM should not set the instanceID
pGroup->SetGroupInstanceID(in->m_instanceId);
DEBUG_LOG("InstanceMgr", "Prepared new instance %u for player %u and group %u on map %u. (%u)",in->m_instanceId, in->m_creatorGuid, in->m_creatorGroup, in->m_mapId, in->m_instanceId);
// apply it in the instance map
instancemap->insert( InstanceMap::value_type( in->m_instanceId, in ) );
// create the actual instance (if we don't GetInstance() won't be able to access it).
in->m_mapMgr = _CreateInstance(in);
// instance created ok, i guess? return the ok for him to transport.
m_mapLock.Release();
return INSTANCE_OK;
}