本文整理汇总了C++中ObjectManager::scheduleRemoveObject方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectManager::scheduleRemoveObject方法的具体用法?C++ ObjectManager::scheduleRemoveObject怎么用?C++ ObjectManager::scheduleRemoveObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectManager
的用法示例。
在下文中一共展示了ObjectManager::scheduleRemoveObject方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doOrder
//.........这里部分代码省略.........
int leaderID = getLeaderInRegion(*(regions.begin()), leaderName);
if(leaderID < 0 && leaderName.compare("SettlerLeaderShip") != 0) {
leaderID = getLeaderInRegion(*(regions.begin()), "SettlerLeaderShip");
}
if(leaderID >= 0) {
Fleet* leader = (Fleet*) ((obm->getObject((uint32_t) leaderID))->getObjectBehaviour());
Player::Ptr owner = Game::getGame()->getPlayerManager()->getPlayer(leader->getOwner());
owner->setScore(scoreType, owner->getScore(scoreType) + 1);
}
//Add the newly colonized system to the region
starSysData->setRegion(*(regions.begin()));
stringstream out;
out << starSysData->getRegion();
Logger::getLogger()->debug(string("System " + newStarSys->getName() + " added to region " + out.str()).c_str());
} else {
// This means that 2 regions are being connected. Perform check
// for external combat
map<uint32_t, uint32_t> settlers;
map<uint32_t, uint32_t> scientists;
map<uint32_t, uint32_t> merchants;
map<uint32_t, uint32_t> miners;
for(set<uint32_t>::iterator i = regions.begin(); i != regions.end(); i++) {
int temp = getLeaderInRegion(*i, "SettlerLeaderShip");
if(temp != -1) {
settlers[temp] = *i;
}
temp = getLeaderInRegion(*i, "ScientistLeaderShip");
if(temp != -1) {
scientists[temp] = *i;
}
temp = getLeaderInRegion(*i, "MerchantLeaderShip");
if(temp != -1) {
merchants[temp] = *i;
}
temp = getLeaderInRegion(*i, "MiningLeaderShip");
if(temp != -1) {
miners[temp] = *i;
}
}
TaeTurn* turn = (TaeTurn*) Game::getGame()->getTurnProcess();
bool conflict = false;
if(settlers.size() > 1) {
//Settler Conflict!
turn->queueCombatTurn(false, settlers);
conflict = true;
}
if(scientists.size() > 1) {
//Scientist Conflict!
turn->queueCombatTurn(false, scientists);
conflict = true;
}
if(merchants.size() > 1) {
//Merchant Conflict!
turn->queueCombatTurn(false, merchants);
conflict = true;
}
if(miners.size() > 1) {
//Miner Conflict!
turn->queueCombatTurn(false, miners);
conflict = true;
}
if(!conflict) {
uint32_t region = *(regions.begin());
set<uint32_t> objects = obm->getAllIds();
for(set<uint32_t>::iterator i = objects.begin(); i != objects.end(); i++) {
IGObject::Ptr ob = obm->getObject(*i);
if(ob->getType() == obtm->getObjectTypeByName("Star System")) {
StarSystem* sys = (StarSystem*) ob->getObjectBehaviour();
uint32_t r = sys->getRegion();
if(r != region && regions.count(r) > 0) {
sys->setRegion(region);
}
}
}
}
}
obm->doneWithObject(newStarSys->getID());
// post completion message
Message::Ptr msg( new Message() );
msg->setSubject("Colonize fleet order complete");
msg->setBody(string("You're fleet, \"" + obj->getName() + "\" has colonized ")
+ newStarSys->getName() + ".");
msg->addReference(rst_Action_Order, rsorav_Completion);
msg->addReference(rst_Object, starSys->getObjectId());
msg->addReference(rst_Object, obj->getID());
player->postToBoard(msg);
//Remove fleet
obj->removeFromParent();
obm->scheduleRemoveObject(obj->getID());
return true;
}