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


C++ Transporter::AddToWorld方法代码示例

本文整理汇总了C++中Transporter::AddToWorld方法的典型用法代码示例。如果您正苦于以下问题:C++ Transporter::AddToWorld方法的具体用法?C++ Transporter::AddToWorld怎么用?C++ Transporter::AddToWorld使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Transporter的用法示例。


在下文中一共展示了Transporter::AddToWorld方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleTransporterMapChange

void ClusterInterface::HandleTransporterMapChange(WorldPacket & pck)
{
	//remove when this is stable, ROFL
	DEBUG_LOG("Transport", "Handling clustered map change");
	uint32 tentry, mapid;
	float x, y, z;
	pck >> tentry >> mapid >> x >> y >> z;

	Transporter* t = objmgr.GetTransporterByEntry(tentry);

	//we need to add to our map
	MapMgr* mgr = sInstanceMgr.GetMapMgr(mapid);

	LocationVector l;
	l.x = x;
	l.y = y;
	l.z = z;

	if (mgr == NULL)
		return;

	if (t->IsInWorld())
		t->RemoveFromWorld(false);
	t->SetMapId(mapid);
	//don't start instantly, we start after eventclustermapchange is finished :P
	sEventMgr.RemoveEvents(t);
	//t->m_canmove = false;
	t->AddToWorld(mgr);
	sEventMgr.AddEvent(t, &Transporter::EventClusterMapChange, mapid, l, EVENT_UNK, 1, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT | EVENT_FLAG_MOVE_TO_WORLD_CONTEXT);
}
开发者ID:,项目名称:,代码行数:30,代码来源:

示例2: LoadTransportInInstance

Transporter* ObjectMgr::LoadTransportInInstance(MapMgr *instance, uint32 goEntry, uint32 period)
{
    auto gameobject_info = sMySQLStore.getGameObjectProperties(goEntry);
    if (gameobject_info == nullptr)
    {
        LOG_ERROR("Transport ID:%u, will not be loaded, gameobject_properties missing", goEntry);
        return NULL;
    }

    if (gameobject_info->type != GAMEOBJECT_TYPE_MO_TRANSPORT)
    {
        LOG_ERROR("Transport ID:%u, Name: %s, will not be loaded, gameobject_properties type wrong", goEntry, gameobject_info->name.c_str());
        return NULL;
    }

    std::set<uint32> mapsUsed;

    Transporter* t = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | goEntry);

    // Generate waypoints
    if (!t->GenerateWaypoints(gameobject_info->mo_transport.taxi_path_id))
    {
        LOG_ERROR("Transport ID:%u, Name: %s, failed to create waypoints", gameobject_info->entry, gameobject_info->name.c_str());
        delete t;
        return NULL;
    }

    // Create Transporter
    if (!t->Create(goEntry, period))
    {
        delete t;
        return NULL;
    }

    m_Transporters.insert(t);
    m_TransportersByInstanceIdMap[instance->GetInstanceID()].insert(t);
    AddTransport(t);

    // AddObject To World
    t->AddToWorld(instance);

    // correct incorrect instance id's
    t->SetInstanceID(instance->GetInstanceID());
    t->SetMapId(t->GetMapId());

    t->BuildStartMovePacket(instance);
    t->BuildStopMovePacket(instance);
    t->m_WayPoints.clear(); // Make transport stopped at server-side, movement will be handled by scripts

    LogDetail("Transport Handler : Spawned Transport Entry %u, map %u, instance id %u", goEntry, t->GetMapId(), t->GetInstanceID());
    return t;
}
开发者ID:armm77,项目名称:AscEmu,代码行数:52,代码来源:TransporterHandler.cpp

示例3: LoadTransports

void ObjectMgr::LoadTransports()
{
    LogNotice("TransportHandler : Start creating transports...");
    {
        uint32_t createCount = 0;

        for (auto it : sMySQLStore._transportDataStore)
        {
            GameObjectProperties const* gameobject_info = sMySQLStore.getGameObjectProperties(it.first);

            std::set<uint32> mapsUsed;

            Transporter* pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | it.first);

            if (pTransporter->GenerateWaypoints(gameobject_info->mo_transport.taxi_path_id) == false)
            {
                LOG_ERROR("Transport entry: %u, failed to create waypoints", it.first);
                delete pTransporter;
                continue;
            }

            if (pTransporter->Create(it.first, it.second.period) == false)
            {
                delete pTransporter;
                continue;
            }

            pTransporter->AddToWorld();

            m_Transporters.insert(pTransporter);
            AddTransport(pTransporter);

            for (std::set<uint32>::const_iterator i = mapsUsed.begin(); i != mapsUsed.end(); ++i)
            {
                m_TransportersByMap[*i].insert(pTransporter);
            }

            ++createCount;
        }

        LogDetail("Transporter Handler : Created %u transports", createCount);
    }

    LogNotice("TransportHandler : Start populating transports with creatures...");
    {
        for (auto it : sMySQLStore._transportCreaturesStore)
        {
            for (ObjectMgr::TransporterSet::iterator itr = m_Transporters.begin(); itr != m_Transporters.end(); ++itr)
            {
                if ((*itr)->getEntry() == it.second.transportEntry)
                {
                    TransportSpawn spawn{ it.second.guid, it.second.entry, it.second.transportEntry, it.second.transportOffsetX, it.second.transportOffsetY, it.second.transportOffsetZ, it.second.transportOffsetO, it.second.animation };
                    (*itr)->AddCreature(spawn);
                    break;
                }
            }
        }

        for (auto transport : m_Transporters)
        {
            transport->RespawnCreaturePassengers();
        }
    }
}
开发者ID:armm77,项目名称:AscEmu,代码行数:64,代码来源:TransporterHandler.cpp


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