本文整理匯總了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;
}