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


C++ Datapad::RemoveWaypoint方法代码示例

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


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

示例1: handleDatabaseJobComplete

void Tutorial::handleDatabaseJobComplete(void* ref,swganh::database::DatabaseResult* result)
{
    TutorialQueryContainer* asyncContainer = reinterpret_cast<TutorialQueryContainer*>(ref);

    switch(asyncContainer->mQueryType)
    {
    case TutorialQuery_MainData:
    {
        swganh::database::DataBinding* binding = gWorldManager->getKernel()->GetDatabase()->createDataBinding(3);
        binding->addField(swganh::database::DFT_uint32,offsetof(Tutorial,mState),4,0);
        binding->addField(swganh::database::DFT_int32,offsetof(Tutorial,mSubState),4,1);
        binding->addField(swganh::database::DFT_bstring,offsetof(Tutorial,mStartingProfession),64,2);

        uint64 count = result->getRowCount();

        if (count == 1)
        {
            result->getNextRow(binding,this);
        }
        else if (count == 0)
        {
            // First time, no tutorial data saved.
            mSubState = 1;
            mState = 1;

            // Save the state.
            (gWorldManager->getKernel()->GetDatabase())->executeSqlAsync(0,0,"INSERT INTO %s.character_tutorial VALUES (%"PRIu64",%u,%u)",gWorldManager->getKernel()->GetDatabase()->galaxy(),asyncContainer->mId,mState, mSubState);
    
        }
        gWorldManager->getKernel()->GetDatabase()->destroyDataBinding(binding);

        // Here we go...
        this->startScript();
    }
    break;

    case TutorialQuery_PlanetLocation:
    {
        PlayerObject* player = dynamic_cast<PlayerObject*>(gWorldManager->getObjectById(asyncContainer->mId));
        if (player)
        {
            swganh::database::DataBinding* binding = gWorldManager->getKernel()->GetDatabase()->createDataBinding(4);
            TutorialStartingLocation startingLocation;

            binding->addField(swganh::database::DFT_uint32, offsetof(TutorialStartingLocation, destinationPlanet), 4, 0);
            binding->addField(swganh::database::DFT_float, offsetof(TutorialStartingLocation, destX), 4, 1);
            binding->addField(swganh::database::DFT_float, offsetof(TutorialStartingLocation, destY), 4, 2);
            binding->addField(swganh::database::DFT_float, offsetof(TutorialStartingLocation, destZ), 4, 3);

            result->getNextRow(binding, &startingLocation);

            startingLocation.destX += (gRandom->getRand()%5 - 2);
            startingLocation.destZ += (gRandom->getRand()%5 - 2);

            gMessageLib->sendClusterZoneTransferRequestByPosition(player,
                    glm::vec3(startingLocation.destX, startingLocation.destY, startingLocation.destZ),
                    startingLocation.destinationPlanet);

            // create waypoint at starting location.
            glm::vec3 position;
            position.x = startingLocation.destX;
            position.z = startingLocation.destZ;

            Datapad* datapad = player->getDataPad();

			std::string name("@ui:cpt_avatar_location");
			std::u16string name_u16(name.begin(), name.end());

            std::shared_ptr<WaypointObject> wp = datapad->getWaypointByName(name_u16);
            
			if(wp)
            {
				datapad->RemoveWaypoint(wp->getId());
            }
			
            datapad->requestNewWaypoint(name_u16, position, startingLocation.destinationPlanet, Waypoint_blue);

            //send starting emails
            sendStartingMails();
        }
        else
        {
        }
    }
    break;

    default:
    {
    }
    break;
    }
    delete asyncContainer;

}
开发者ID:ELMERzark,项目名称:mmoserver,代码行数:94,代码来源:Tutorial.cpp

示例2: destroyObject

void ObjectController::destroyObject(uint64 objectId)
{
	
	CreatureObject* creature  = dynamic_cast<CreatureObject*>(mObject); PlayerObject* playerObject = creature->GetGhost();
	Datapad*		datapad			= playerObject->getDataPad();
	Object*			object			= gWorldManager->getObjectById(objectId);

	auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService");
	auto inventory = dynamic_cast<Inventory*>(equip_service->GetEquippedObject(playerObject->GetCreature(), "inventory"));

	//could be a schematic!
	ManufacturingSchematic* schem	= datapad->getManufacturingSchematicById(objectId);

	if(schem != NULL)
	{
		//delete schematic
		datapad->removeManufacturingSchematic(objectId);

		//delete schematic object
		gObjectFactory->deleteObjectFromDB(schem);
		gMessageLib->sendDestroyObject(objectId,playerObject);

		return;
	}

	

	// or something else
	if(object == NULL)
	{
		DLOG(info) << "ObjController::destroyObject: could not find object " << objectId;
		return;
	}

	// waypoint
	if(object->getType() == ObjType_Waypoint)
	{
		// delete from db
		gObjectFactory->deleteObjectFromDB(object);
		
		if(!datapad)	{
			LOG(error) << "ObjectController::destroyObject cant get datapad to destroy waypoint : " << object->getId();
			return;
		}

		datapad->RemoveWaypoint(object->getId());

		//remove from grid and/or container
		gWorldManager->destroyObject(object);
		
	}

	//Inangible Objects
	if(object->getType() == ObjType_Intangible)
	{
		
		gObjectFactory->deleteObjectFromDB(object);
		
		//remove from grid and/or container
		gWorldManager->destroyObject(object);
		
	}


	// tangible
	else if(object->getType() == ObjType_Tangible)
	{
		TangibleObject* tangibleObject = dynamic_cast<TangibleObject*>(object);
		
		auto equip_service = gWorldManager->getKernel()->GetServiceManager()->GetService<swganh::equipment::EquipmentService>("EquipmentService");
		auto inventory = dynamic_cast<Inventory*>(equip_service->GetEquippedObject(playerObject->GetCreature(), "inventory"));

		// items
		if(Item* item = dynamic_cast<Item*>(tangibleObject))
		{
			// handle any family specifics
			switch(item->getItemFamily())
			{
				case ItemFamily_CraftingTools:	_handleDestroyCraftingTool(dynamic_cast<CraftingTool*>(item));	break;
				case ItemFamily_Instrument:		_handleDestroyInstrument(item);									break;

				default:break;
			}

		}
		
		
		// reset pending ui callbacks
		playerObject->resetUICallbacks(object);

		

		// delete from db CAVE :: mark if its an Object saved in the db!!!!
		// temporary placed instruments are not saved in the db
		gObjectFactory->deleteObjectFromDB(object);

		//remove from grid and/or container and/or World
		gWorldManager->destroyObject(object);
		
	}
//.........这里部分代码省略.........
开发者ID:ELMERzark,项目名称:mmoserver,代码行数:101,代码来源:OCDestroyHandlers.cpp


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