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


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

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


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

示例1: LoadTransporters

void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
	return;
#endif
	//!!!!!!!!!!!!! CATA !!!!!!!!!!! 
	// this seems to deadlock maps, disabling it until properly implemented
	return;
	//!!!!!!!!!!!!! CATA !!!!!!!!!!! 

	Log.Notice("ObjectMgr", "Loading Transports...");
	QueryResult * QR = WorldDatabase.Query("SELECT entry FROM gameobject_names WHERE type = %u", GAMEOBJECT_TYPE_MO_TRANSPORT);
	if(!QR) return;

	int32 total = QR->GetRowCount();
	do 
	{
		uint32 entry = QR->Fetch()[0].GetUInt32();

		//never do this !
//		Transporter * pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER<<32 | entry); //wtf ?
		uint32 lowguid = objmgr.GenerateLowGuid( HIGHGUID_TYPE_TRANSPORTER );
		Transporter * pTransporter = new Transporter(((uint64)HIGHGUID_TYPE_TRANSPORTER<<32) | lowguid);
		if(!pTransporter->CreateAsTransporter(entry, ""))
		{
			sLog.outDebug("Transporter %d failed creation for some reason.", entry);
			delete pTransporter;
			pTransporter = NULL;
		}else
		{
            AddTransport(pTransporter);

			QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
			if(result2)
			{
				do 
				{
					pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
						result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
						result2->Fetch()[5].GetFloat());

				} while (result2->NextRow());
				delete result2;
				result2 = NULL;
			}
		}

	} while(QR->NextRow());
	delete QR;
	QR = NULL;
}
开发者ID:AtVirus,项目名称:Descent-core,代码行数:51,代码来源:TransporterHandler.cpp

示例2: LoadTransporters

void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
	return;
#endif
	Log.Notice("ObjectMgr", "Loading Transports...");
	QueryResult * QR = WorldDatabase.Query("SELECT entry FROM gameobject_names WHERE type = %u", GAMEOBJECT_TYPE_MO_TRANSPORT);
	if(!QR)
		return;

	int64 total = QR->GetRowCount();
	TransportersCount = total;
	uint32 entry = NULL;
	Transporter* pTransporter = NULL;
	do
	{
		entry = QR->Fetch()[0].GetUInt32();

		pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER<<32 | entry);
		pTransporter->Init();
		if(!pTransporter->CreateAsTransporter(entry, ""))
		{
			Log.Warning("ObjectMgr","Skipped invalid transporterid %d.", entry);
			pTransporter->Destruct();
			pTransporter = NULL;
		}
		else
		{
			AddTransport(pTransporter);

			QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
			if(result2)
			{
				do
				{
					pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
						result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
						result2->Fetch()[5].GetFloat());

				} while (result2->NextRow());
				delete result2;
			}
		}

	} while(QR->NextRow());
	delete QR;
}
开发者ID:WowDevs,项目名称:sandshroud-1,代码行数:47,代码来源:TransporterHandler.cpp

示例3: LoadTransporters

void ObjectMgr::LoadTransporters()
{
#ifdef CLUSTERING
    return;
#endif
    Log.Notice("ObjectMgr", "Loading Transports...");
    QueryResult * QR = WorldDatabase.Query("SELECT * FROM transport_data");
    if (!QR) return;

    int64 total = QR->GetRowCount();
    TransportersCount = total;
    do
    {
        uint32 entry = QR->Fetch()[0].GetUInt32();
        int32 period = QR->Fetch()[2].GetInt32();

        Transporter * pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | entry);
        if (!pTransporter->CreateAsTransporter(entry, "", period))
        {
            sLog.outError("Transporter %s failed creation for some reason.", QR->Fetch()[1].GetString());
            delete pTransporter;
        }
        else
        {
            AddTransport(pTransporter);

            QueryResult * result2 = WorldDatabase.Query("SELECT * FROM transport_creatures WHERE transport_entry = %u", entry);
            if (result2)
            {
                do
                {
                    pTransporter->AddNPC(result2->Fetch()[1].GetUInt32(), result2->Fetch()[2].GetFloat(),
                                         result2->Fetch()[3].GetFloat(), result2->Fetch()[4].GetFloat(),
                                         result2->Fetch()[5].GetFloat());

                }
                while (result2->NextRow());
                delete result2;
            }
        }

    }
    while (QR->NextRow());
    delete QR;
}
开发者ID:Nupper,项目名称:AscEmu_Vanilla,代码行数:45,代码来源:TransporterHandler.cpp

示例4: LoadTransporters

void ObjectMgr::LoadTransporters()
{
    Log.Notice("TransporterHandler", "Start loading transport_data");
    {
        const char* loadAllTransportData = "SELECT entry, name, period FROM transport_data";

        QueryResult* result = WorldDatabase.Query(loadAllTransportData);
        if (!result)
        {
            Log.Error("TransporterHandler", "Query failed: %s", loadAllTransportData);
            return;
        }

        uint32 count = 0;
        do
        {
            Field* field = result->Fetch();

            TransporterDataQueryResult dbResult;
            dbResult.entry = field[0].GetUInt32();
            dbResult.name = field[1].GetString();
            dbResult.period = field[2].GetUInt32();

            GameObjectInfo* goInfo = GameObjectNameStorage.LookupEntry(dbResult.entry);
            if (goInfo == nullptr)
            {
                Log.Error("TransporterHandler", "Transporter gameobject %u not available in GameObjectNameStorage!", dbResult.entry);
                continue;
            }

            Transporter* pTransporter = new Transporter((uint64)HIGHGUID_TYPE_TRANSPORTER << 32 | dbResult.entry);
            pTransporter->SetInfo(goInfo);
            if (!pTransporter->CreateAsTransporter(dbResult.entry, "", dbResult.period))
            {
                Log.Error("TransporterHandler", "Transporter %s failed creation for some reason.", dbResult.name.c_str());
                delete pTransporter;
            }
            else
            {
                Log.Debug("TransporterHandler", "%s, Entry: %u, Period: %u loaded", dbResult.name.c_str(), dbResult.entry, dbResult.period);
                AddTransport(pTransporter);
                ++count;
            }

        }
        while (result->NextRow());

        delete result;
        Log.Success("TransporterHandler", "%u transporters loaded from table transporter_data", count);
    }

    Log.Notice("TransporterHandler", "Start loading transport_creatures");
    {
        const char* loadTransportPassengers = "SELECT transport_entry, creature_entry, position_x, position_y, position_z, orientation FROM transport_creatures";
        bool success = false;
        QueryResult* result = WorldDatabase.Query(&success, loadTransportPassengers);
        if (!success)
        {
            Log.Error("TransporterHandler", "Query failed: %s", loadTransportPassengers);
            return;
        }

        uint32 count = 0;
        if (result)
        {
            do
            {
                Field* field = result->Fetch();

                uint32 transport_entry = field[0].GetUInt32();
                uint32 creature_entry = field[1].GetUInt32();

                auto transporter = GetTransporterByEntry(transport_entry);
                if (transporter == nullptr)
                {
                    Log.Error("TransporterHandler", "Could not find transporter %u for transport_creatures entry %u", transport_entry, creature_entry);
                    continue;
                }

                TransporterCreaturesQueryResult dbResult;
                dbResult.transport_entry = field[0].GetUInt32();
                dbResult.creature_entry = field[1].GetUInt32();
                dbResult.position_x = field[2].GetFloat();
                dbResult.position_y = field[3].GetFloat();
                dbResult.position_z = field[4].GetFloat();
                dbResult.orientation = field[5].GetFloat();

                transporter->creature_transport_data.push_back(dbResult);

                transporter->AddNPC(dbResult.creature_entry, dbResult.position_x, dbResult.position_y, dbResult.position_z, dbResult.orientation);

                ++count;

            }
            while (result->NextRow());
            delete result;
            Log.Success("TransporterHandler", "%u transport passengers from table transport_creatures loaded.", count);
        }
    }
}
开发者ID:TheGhostGroup,项目名称:AscEmu,代码行数:100,代码来源:TransporterHandler.cpp


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