本文整理汇总了C++中Datapad::addMission方法的典型用法代码示例。如果您正苦于以下问题:C++ Datapad::addMission方法的具体用法?C++ Datapad::addMission怎么用?C++ Datapad::addMission使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Datapad
的用法示例。
在下文中一共展示了Datapad::addMission方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: missionRequest
/*
* Player Accepted Mission
*/
void MissionManager::missionRequest(PlayerObject* player, uint64 mission_id)
{
Datapad* datapad = dynamic_cast<Datapad*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_Datapad));
//Move the mission from the player's mission bag to his datapad.
MissionBag* mission_bag = dynamic_cast<MissionBag*>(player->getEquipManager()->getEquippedObject(CreatureEquipSlot_MissionBag));
MissionObject* mission = mission_bag->getMissionById(mission_id);
if(mission == NULL)
{
gLogger->logMsgF("ERROR: Failed to retrieve mission with id %"PRIu64". Unable to accept mission!", MSG_HIGH, mission_id);
return;
}
//automatically checks the datapads capacity
if(!datapad->addMission(mission))
{
gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","too_many_missions");
return;
}
mission_bag->removeMission(mission);
gMessageLib->sendContainmentMessage(mission->getId(), datapad->getId(), 0xffffffff, player);
//Replace it with a new mission.
mission_bag->spawnNAdd();
//Send MissionGenericResponse to tell the client its been accepted
gMessageLib->sendMissionGenericResponse(mission,player);
//Update the name and mission waypoint
MissionObject* updater = new MissionObject();
updater->clear();
updater->setId(mission->getId());
updater->setNameFile(mission->getTitleFile().getRawData());
updater->setName(mission->getTitle().getRawData());
if(mission->getMissionType() != survey)
{
updater->getWaypoint()->setId(mission->getId()+1);
if(mission->getMissionType() == deliver || mission->getMissionType() == crafting)
{
updater->getWaypoint()->setCoords(mission->getStart().Coordinates);
updater->getWaypoint()->setPlanetCRC(mission->getStart().PlanetCRC);
}
else
{
updater->getWaypoint()->setCoords(mission->getDestination().Coordinates);
updater->getWaypoint()->setPlanetCRC(mission->getDestination().PlanetCRC);
}
char name[150];
sprintf(name, "@%s:%s",mission->getTitleFile().getRawData(),mission->getTitle().getRawData());
updater->getWaypoint()->setName(name);
updater->getWaypoint()->setActive(true);
}
else
{
gMessageLib->sendSystemMessage(player,L"","mission/mission_generic","survey_start");
}
//Accept the mission let the player know
gMessageLib->sendPlayMusicMessage(WMSound_Mission_Accepted,player); //3887, 'sound/music_mission_accepted.snd'
gMessageLib->sendMISO_Delta(updater,player);
mission->sendAttributes(mission->getOwner());
delete updater;
if(mission->getMissionType() == recon) mission->setTaskId(gWorldManager->addMissionToProcess(mission));
//check if we need to inform our group
if((mission->getMissionType() == destroy)&&(player->getGroupId() != 0))
{
// we are in a group and just accepted a destroy mission
// check the missions and update the nearest waypoint
GroupObject* group = gGroupManager->getGroupObject(player->getGroupId());
gGroupManager->sendGroupMissionUpdate(group);
}
return;
}