bool CvSelectionGroupAI::AI_launchAssault(CvPlot* pTargetCityPlot) { std::multimap<int, CvUnit*, std::greater<int> > units; std::multimap<int, CvUnit*, std::greater<int> >::iterator units_it; CLLNode<IDInfo>* pUnitNode = plot()->headUnitNode(); CvUnit* pLoopUnit; while (pUnitNode != NULL) { pLoopUnit = ::getUnit(pUnitNode->m_data); pUnitNode = plot()->nextUnitNode(pUnitNode); if (pLoopUnit->isCargo()) { if (pLoopUnit->getTransportUnit()->getGroup() == this) { int iValue = pLoopUnit->baseCombatStr(); if (pLoopUnit->canAttack()) { iValue *= 10; } iValue *= 100; units.insert(std::make_pair(iValue, pLoopUnit)); } } } if (units.empty()) { return false; } bool bAction = false; for (units_it = units.begin(); units_it != units.end(); ++units_it) { pLoopUnit = units_it->second; if (pLoopUnit->canMove() && pLoopUnit->canAttack()) { // if (pLoopUnit->AI_attackFromTransport(NULL, 40, 80)) // { // bAction = true; // } int iPriority = 41; pLoopUnit->AI_setMovePriority(iPriority); } } // for (units_it = units.begin(); units_it != units.end(); ++units_it) // { // pLoopUnit = units_it->second; // if (pLoopUnit->canMove()) // { // if (pLoopUnit->AI_moveFromTransport(NULL)) // { // bAction = true; // } // } // } // for (units_it = units.begin(); units_it != units.end(); ++units_it) // { // pLoopUnit = units_it->second; // if (pLoopUnit->canMove() && pLoopUnit->canAttack()) // { // if (pLoopUnit->AI_attackFromTransport(NULL, 0, 100)) // { // bAction = true; // } // } // } if (bAction) { //pushMission(MISSION_SKIP); return true; } return false; }