本文整理汇总了C++中MapPersistentState::GetMapId方法的典型用法代码示例。如果您正苦于以下问题:C++ MapPersistentState::GetMapId方法的具体用法?C++ MapPersistentState::GetMapId怎么用?C++ MapPersistentState::GetMapId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapPersistentState
的用法示例。
在下文中一共展示了MapPersistentState::GetMapId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void PoolGroup<GameObject>::ReSpawn1Object(MapPersistentState& mapState, PoolObject* obj)
{
if (GameObjectData const* data = sObjectMgr.GetGOData(obj->guid))
{
// for non-instanceable maps pool spawn can be at different map from provided mapState
if (MapPersistentState* dataMapState = mapState.GetMapId() == data->mapid ? &mapState : sMapPersistentStateMgr.GetPersistentState(data->mapid, 0))
if (Map* dataMap = dataMapState->GetMap())
if (GameObject* pGameobject = dataMap->GetGameObject(ObjectGuid(HIGHGUID_GAMEOBJECT, data->id, obj->guid)))
pGameobject->GetMap()->Add(pGameobject);
}
}
示例2: if
void PoolGroup<GameObject>::Spawn1Object(MapPersistentState& mapState, PoolObject* obj, bool instantly)
{
if (GameObjectData const* data = sObjectMgr.GetGOData(obj->guid))
{
MapEntry const* mapEntry = sMapStore.LookupEntry(data->mapid);
// for non-instanceable maps pool spawn can be at different map from provided mapState
if (MapPersistentState* dataMapState = mapState.GetMapId() == data->mapid ? &mapState : sMapPersistentStateMgr.GetPersistentState(data->mapid, 0))
{
dataMapState->AddGameobjectToGrid(obj->guid, data);
Map* dataMap = dataMapState->GetMap();
// We use spawn coords to spawn
if (dataMap && dataMap->IsLoaded(data->posX, data->posY))
{
GameObject* pGameobject = new GameObject;
//DEBUG_LOG("Spawning gameobject %u", obj->guid);
if (!pGameobject->LoadFromDB(obj->guid, dataMap))
{
delete pGameobject;
return;
}
else
{
if (pGameobject->isSpawnedByDefault())
{
// if new spawn replaces a just despawned object, not instantly spawn but set respawn timer
if(!instantly)
{
pGameobject->SetRespawnTime( pGameobject->GetRespawnDelay() );
if (sWorld.getConfig(CONFIG_BOOL_SAVE_RESPAWN_TIME_IMMEDIATELY))
pGameobject->SaveRespawnTime();
}
dataMap->Add(pGameobject);
}
}
}
// for not loaded grid just update respawn time (avoid work for instances until implemented support)
else if(!instantly)
{
// for spawned by default object only
if (data->spawntimesecs >= 0)
dataMapState->SaveGORespawnTime(obj->guid, time(NULL) + data->spawntimesecs);
}
}
}
}