示例#1
0
// Cancel all requests with a parent index in the range from startPI to endPI (inclusive)
void ex_queue::cancelRequestWithParentIndexRange(queue_index startPI, queue_index endPI)
{
  queue_index i = head_;

  // search through all existing entries for the parent indexes within the range
  if(endPI >= startPI) {
    while (!isVacant(i))
      {
        // if this entry is within the range, cancel it
        if (queue_[i&mask_].downState.parentIndex >= startPI &&
            queue_[i&mask_].downState.parentIndex <= endPI)
          cancelRequest(i);
        i++;
      }
  } else if(startPI > endPI) {
    // If endPI has wrapped around, the range also wraps.
    while (!isVacant(i))
      {
        // if this entry is within the range, cancel it
        if (queue_[i&mask_].downState.parentIndex >= startPI ||
            queue_[i&mask_].downState.parentIndex <= endPI)
          cancelRequest(i);
        i++;
      }
  }
}
示例#2
0
void ex_queue::cancelRequestWithParentIndex(queue_index pindex)
{
  queue_index i = head_;

  // search through all existing entries for the given parent index
  while (!isVacant(i))
    {
      // if this entry has the given parent index, cancel it
      if (queue_[i&mask_].downState.parentIndex == pindex)
        cancelRequest(i);
      i++;
    }
}
示例#3
0
void CCoverageCell::update(std::list<CUnit*>& uncovered) {
	if (isVacant())	return;

	float newRange = ai->coverage->getCoreRange(type, unit->type);
	if (newRange < range) {
		const float3 center = getCenter();
		for (std::map<int, CUnit*>::iterator it = units.begin(); it != units.end(); ) {
			const float3 pos = it->second->pos();
			if (center.distance2D(pos) > newRange) {
				uncovered.push_back(it->second);
				it->second->unreg(*this);
				units.erase(it++);
			}
			else
				++it;
		}

		range = newRange;
	}

	// TODO: if core is mobile then update it when position has changed
}