本文整理汇总了C++中ObjectSet::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectSet::empty方法的具体用法?C++ ObjectSet::empty怎么用?C++ ObjectSet::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectSet
的用法示例。
在下文中一共展示了ObjectSet::empty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: playerInRange
bool LairObject::playerInRange(float range)
{
ObjectSet inRangeObjects;
// ObjectSet::iterator objectSetIt;
// Make Set ready,
// inRangeObjects.clear();
// objectSetIt = mInRangeObjects.begin(); // Will point to end of Set
if (QTRegion* region = gWorldManager->getSI()->getQTRegion(this->mPosition.x, this->mPosition.z))
{
// gLogger->logMsg("LairObject::playerInRange Looking for players");
Anh_Math::Rectangle qRect = Anh_Math::Rectangle(this->mPosition.x - range, this->mPosition.z - range, range * 2, range * 2);
region->mTree->getObjectsInRange(this, &inRangeObjects, ObjType_Player, &qRect);
}
return !inRangeObjects.empty();
}
示例2: generateCraftingMission
MissionObject* MissionManager::generateCraftingMission(MissionObject* mission)
{
mission->setMissionType(crafting);
//TEMP!
string targets[8][2] =
{
{"@item_n:output_governor","object/tangible/mission/quest_item/shared_attunement_grid.iff"},
{"@item_n:current_alternator","object/tangible/mission/quest_item/shared_current_alternator.iff"},
{"@item_n:nym_hard_drive","object/tangible/loot/quest/shared_nym_hard_drive.iff"},
{"@item_n:hyperdrive_part_s01","object/tangible/loot/misc/shared_hyperdrive_part_s01.iff"},
{"@item_n:dermal_analyzer","object/tangible/loot/npc_loot/shared_dermal_analyzer_generic.iff"},
{"@item_n:feedback_controller","object/tangible/mission/quest_item/shared_feedback_controller.iff"},
{"@item_n:power_regulator","object/tangible/mission/quest_item/shared_power_regulator.iff"},
{"@item_n:attunement_grid","object/tangible/mission/quest_item/shared_attunement_grid.iff"}
};
int target_num = gRandom->getRand() % 8;
//END TEMP
//Randomly choose a crafting mission
int mission_num = (gRandom->getRand() % 50)+1;
mission->setNum(mission_num);
//Creator
mission->setCreator(creators[gRandom->getRand() % 9]);
//Title
sprintf(mt,"m%dt",mission_num);
mission->setTitleFile("mission/mission_npc_crafting_neutral_easy");
mission->setTitle(mt);
//Details
sprintf(md,"m%dd",mission_num);
mission->setDetailFile("mission/mission_npc_crafting_neutral_easy");
mission->setDetail(md);
//END TEMP
ObjectSet inRangeNPCs;
gWorldManager->getSI()->getObjectsInRange(mission->getOwner(),&inRangeNPCs,ObjType_NPC,1500);
uint32 cntLoop = 0;
//Start & End
bool found = false;
Location mission_start;
Location mission_dest;
ObjectSet::iterator it = inRangeNPCs.begin();
while(!found && !inRangeNPCs.empty())
{
cntLoop++;
++it;
if(it == inRangeNPCs.end())
it = inRangeNPCs.begin();
NPCObject* npc = dynamic_cast<NPCObject*>(*it);
if(npc->getNpcFamily() == NpcFamily_Filler)
{
uint32 roll = (gRandom->getRand() / (RAND_MAX + 1ul) * (9 - 1) + 1);
if((roll = 5)||(cntLoop > inRangeNPCs.size()))
{
if(mission_dest.Coordinates.x == 0)
{
mission->setDestinationNPC(npc);
mission_dest.Coordinates = npc->mPosition;
mission_dest.CellID = 0;
mission_dest.PlanetCRC = BString(gWorldManager->getPlanetNameThis()).getCrc();
mission->setDestination(mission_dest);
}
else if(mission_start.Coordinates.x == 0 && mission->getDestinationNPC() != npc)
{
mission->setStartNPC(npc);
mission_start.Coordinates = npc->mPosition;
mission_start.CellID = 0;
mission_start.PlanetCRC = BString(gWorldManager->getPlanetNameThis()).getCrc();
mission->setStart(mission_start);
}
else
{
found = true;
}
}
}
}
//Difficulty
mission->setDifficulty((gRandom->getRand() % 41) + 40); //value from 30 - 80
//Reward
mission->setReward(mission->getDifficulty() * ((gRandom->getRand() % 14) + 15)); //Difficulty * rand: 15-28
//Target
mission->setTarget((targets[target_num][0]).getRawData()); //will need to be located from the db
//Mission Target
mission->setTargetModel((targets[target_num][1]).getCrc()); //crc = object/tangible/mission/quest_item/shared_attunement_grid.iff
return mission;
//.........这里部分代码省略.........
示例3: generateEntertainerMission
MissionObject* MissionManager::generateEntertainerMission(MissionObject* mission,int count)
{
count < 5 ?
mission->setMissionType(musician):
mission->setMissionType(dancer);
//Randomly choose an entertainer mission
int mission_num = (gRandom->getRand() % 50)+1;
mission->setNum(mission_num);
ObjectSet inRangeNPCs;
gWorldManager->getSI()->getObjectsInRange(mission->getOwner(),&inRangeNPCs,ObjType_NPC,3000);
//Start
uint32 cntLoop = 0;
bool found = false;
Location mission_dest;
ObjectSet::iterator it = inRangeNPCs.begin();
while(!found && !inRangeNPCs.empty())
{
cntLoop++;
++it;
if(it == inRangeNPCs.end())
it = inRangeNPCs.begin();
NPCObject* npc = dynamic_cast<NPCObject*>(*it);
if(npc->getNpcFamily() == NpcFamily_Filler)
{
uint32 roll = (gRandom->getRand() / (RAND_MAX + 1ul) * (9 - 1) + 1);
if((roll = 5)||(cntLoop > inRangeNPCs.size()))
{
if(mission_dest.Coordinates.x == 0 && mission->getDestinationNPC() != npc)
{
mission->setStartNPC(npc);
mission_dest.Coordinates = npc->mPosition;
mission_dest.CellID = 0;
mission_dest.PlanetCRC = BString(gWorldManager->getPlanetNameThis()).getCrc();
mission->setDestination(mission_dest);
mission->setDestinationNPC(npc);
found = true;
}
}
}
}
//Creator
mission->setCreator(creators[gRandom->getRand() % 9]);
//Mission Title
sprintf(mt,"m%dt",mission_num);
count < 5 ?
mission->setTitleFile("mission/mission_npc_musician_neutral_easy") :
mission->setTitleFile("mission/mission_npc_dancer_neutral_easy");
mission->setTitle(mt);
//Mission Description
sprintf(md,"m%do",mission_num);
count < 5 ?
mission->setDetailFile("mission/mission_npc_musician_neutral_easy") :
mission->setDetailFile("mission/mission_npc_dancer_neutral_easy");
mission->setDetail(md);
//Diffaculty
mission->setDifficulty((gRandom->getRand() % 90)+3);
//Payment
mission->setReward((gRandom->getRand() % 2500)+500);
//Target Name
mission->setTarget("Entertainer");
//Mission Target
mission->setTargetModel(0x491099A6); //crc = object/tangible/instrument/shared_organ_max_rebo.iff
return mission;
}
示例4: generateDeliverMission
MissionObject* MissionManager::generateDeliverMission(MissionObject* mission)
{
mission->setMissionType(deliver);
//TEMP
missionData mission_deliver_hard[2] =
{
{"mission/mission_deliver_neutral_hard",25},
{"mission/mission_deliver_neutral_hard_non_persistent_from_npc",15},
};
//Randomly choose a stf file
int stf_file = gRandom->getRand() % 2;
//Randomly choose a mission in that file
int mission_num = (gRandom->getRand() % mission_deliver_hard[stf_file].num)+1;
mission->setNum(mission_num);
//END TEMP
ObjectSet inRangeNPCs;
gWorldManager->getSI()->getObjectsInRange(mission->getOwner(),&inRangeNPCs,ObjType_NPC,1500);
//Start & End
bool found = false;
Location mission_start;
Location mission_dest;
ObjectSet::iterator it = inRangeNPCs.begin();
//we may stall the main thread with the way it was done ???? however often enough the mission generation never finished!!!!!!!!!!!!!!!
//get a list containing all suitable npcs and generate a random number corresponding to one of the npcs
if(inRangeNPCs.size() < 2)
return NULL;
uint32 count = 0;
while(!found && !inRangeNPCs.empty())
{
count ++;
++it;
if(it == inRangeNPCs.end())
it = inRangeNPCs.begin();
NPCObject* npc = dynamic_cast<NPCObject*>(*it);
if(npc->getNpcFamily() == NpcFamily_Filler)
{
uint32 roll = (gRandom->getRand() / (RAND_MAX + 1ul) * (9 - 1) + 1);
if((roll = 5)||(count > inRangeNPCs.size()))
{
if(mission_dest.Coordinates.x == 0)
{
mission->setDestinationNPC(npc);
mission_dest.Coordinates = npc->mPosition;
mission_dest.CellID = 0;
mission_dest.PlanetCRC = BString(gWorldManager->getPlanetNameThis()).getCrc();
mission->setDestination(mission_dest);
}
else if(mission_start.Coordinates.x == 0 && mission->getDestinationNPC() != npc)
{
mission->setStartNPC(npc);
mission_start.Coordinates = npc->mPosition;
mission_start.CellID = 0;
mission_start.PlanetCRC = BString(gWorldManager->getPlanetNameThis()).getCrc();
mission->setStart(mission_start);
found = true;
}
}
}
}
//Creator
mission->setCreator(creators[gRandom->getRand() % 9]);
//Mission Title
sprintf(mt,"m%dt",mission_num);
mission->setTitleFile(mission_deliver_hard[stf_file].mSTF);
mission->setTitle(mt);
//Mission Description
sprintf(md,"m%dd",mission_num);
mission->setDetailFile(mission_deliver_hard[stf_file].mSTF);
mission->setDetail(md);
//Diffaculty
mission->setDifficulty((gRandom->getRand() % 10)+3);
//Payment
mission->setReward((gRandom->getRand() % 300)+50);
//Mission Target
mission->setTargetModel(0xE191DBAB); //crc = object/tangible/mission/shared_mission_datadisk.iff
//.........这里部分代码省略.........