本文整理汇总了C++中MapPersistentState::GetSpawnedPoolData方法的典型用法代码示例。如果您正苦于以下问题:C++ MapPersistentState::GetSpawnedPoolData方法的具体用法?C++ MapPersistentState::GetSpawnedPoolData怎么用?C++ MapPersistentState::GetSpawnedPoolData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapPersistentState
的用法示例。
在下文中一共展示了MapPersistentState::GetSpawnedPoolData方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void PoolGroup<T>::DespawnObject(MapPersistentState& mapState, uint32 guid)
{
for (size_t i = 0; i < EqualChanced.size(); ++i)
{
// if spawned
if (mapState.GetSpawnedPoolData().IsSpawnedObject<T>(EqualChanced[i].guid))
{
// any or specially requested
if (!guid || EqualChanced[i].guid == guid)
{
Despawn1Object(mapState, EqualChanced[i].guid);
mapState.GetSpawnedPoolData().RemoveSpawn<T>(EqualChanced[i].guid, poolId);
}
}
}
for (size_t i = 0; i < ExplicitlyChanced.size(); ++i)
{
// spawned
if (mapState.GetSpawnedPoolData().IsSpawnedObject<T>(ExplicitlyChanced[i].guid))
{
// any or specially requested
if (!guid || ExplicitlyChanced[i].guid == guid)
{
Despawn1Object(mapState, ExplicitlyChanced[i].guid);
mapState.GetSpawnedPoolData().RemoveSpawn<T>(ExplicitlyChanced[i].guid, poolId);
}
}
}
}
示例2: RollOne
void PoolGroup<T>::SpawnObject(MapPersistentState& mapState, uint32 limit, uint32 triggerFrom, bool instantly)
{
SpawnedPoolData& spawns = mapState.GetSpawnedPoolData();
uint32 lastDespawned = 0;
int count = limit - spawns.GetSpawnedObjects(poolId);
// If triggered from some object respawn this object is still marked as spawned
// and also counted into m_SpawnedPoolAmount so we need increase count to be
// spawned by 1
if (triggerFrom)
{
if (spawns.IsSpawnedObject<T>(triggerFrom))
++count;
else
triggerFrom = 0;
}
// This will try to spawn the rest of pool, not guaranteed
for (int i = 0; i < count; ++i)
{
PoolObject* obj = RollOne(spawns, triggerFrom);
if (!obj)
continue;
if (obj->guid == lastDespawned)
continue;
if (obj->guid == triggerFrom)
{
MANGOS_ASSERT(spawns.IsSpawnedObject<T>(obj->guid));
MANGOS_ASSERT(spawns.GetSpawnedObjects(poolId) > 0);
ReSpawn1Object(mapState, obj);
triggerFrom = 0;
continue;
}
spawns.AddSpawn<T>(obj->guid, poolId);
Spawn1Object(mapState, obj, instantly);
if (triggerFrom)
{
// One spawn one despawn no count increase
DespawnObject(mapState, triggerFrom);
lastDespawned = triggerFrom;
triggerFrom = 0;
}
}
}