当前位置: 首页>>代码示例>>C++>>正文


C++ MapPersistentState::GetMapId方法代码示例

本文整理汇总了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);
    }
}
开发者ID:MrRoggers,项目名称:mangos-mop,代码行数:11,代码来源:PoolManager.cpp

示例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);
            }
        }
    }
}
开发者ID:Sandstorm-Walker,项目名称:MaNGOSZero,代码行数:48,代码来源:PoolManager.cpp


注:本文中的MapPersistentState::GetMapId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。