void CWaitCommandsAI::SquadWait::Update() { if (buildUnits.empty() && ((int)waitUnits.size() < squadCount)) { // FIXME -- unblock remaining waitUnits ? delete this; return; } if ((int)waitUnits.size() >= squadCount) { CUnitSet unblockSet; CUnitSet::iterator it = waitUnits.begin(); while (it != waitUnits.end()) { WaitState state = GetWaitState(*it); if (state == Active) { unblockSet.insert(*it); if ((int)unblockSet.size() >= squadCount) { break; // we've got our squad } } else if (state == Queued) { // do nothing } else if (state == Missing) { DeleteDeathDependence(*it); it = RemoveUnitFromSet(it, waitUnits); continue; } ++it; } if ((int)unblockSet.size() >= squadCount) { // FIXME -- rebuild the order queue so // that formations are created? SendWaitCommand(unblockSet); for (it = unblockSet.begin(); it != unblockSet.end(); ++it) { DeleteDeathDependence(*it); waitUnits.erase(*it); } } } UpdateText(); // FIXME -- clean builders }
bool CProgAndPlay::allUnitsIdled() { CUnitSet *tmp = &(teamHandler->Team(gu->myTeam)->units); if (tmp->size() == 0) return false; CUnitSet::iterator it = tmp->begin(); while (it != tmp->end()) { const CCommandAI* commandAI = (*it)->commandAI; if (commandAI != NULL) { const CCommandQueue* queue = &commandAI->commandQue; if (queue->size() > 0) return false; } it++; } return true; }
bool CProgAndPlay::allUnitsDead() { CUnitSet *tmp = &(teamHandler->Team(gu->myTeam)->units); return tmp->size() == 0; }