Ejemplo n.º 1
0
void Board::move(int ipiece, int x, int y)
{
	if (x > 0) x = 1;
	if (x < 0) x = -1;
	if (y > 0) y = 1;
	if (y < 0) y = -1;

	if (canmove(ipiece, (x * pper()) + pborder(), (y*pper())+pborder())
		|| mWon)
		piece(ipiece)->mov(x,y);

}
Ejemplo n.º 2
0
AirspaceRoute::ClearingPair
AirspaceRoute::find_clearing_pair(const SearchPointVector& spv,
                                  const SearchPointVector::const_iterator start,
                                  const SearchPointVector::const_iterator end,
                                  const RoutePoint &dest) const
{
  bool backwards = false;
  ClearingPair p(dest, dest);

  bool check_others = false;

  SearchPointVector::const_iterator i= start;

  int j=0;
  while ((i != end)&&(j<2)) {
    AFlatGeoPoint pborder(i->get_flatLocation(), dest.altitude); // @todo alt!
    const FlatRay ray(pborder, dest);

    if (intersects(spv, ray)) {
      j++;
      if (j==1) {
        i = start;
        backwards = true;
        continue;
      }
    } else {
      AGeoPoint gborder(task_projection.unproject(pborder), dest.altitude); // @todo alt!
      if (!check_others || !inside_others(gborder)) {
        if (j==0) {
          p.first = pborder;
        } else if (j==1) {
          p.second = pborder;
        }
      }
    }

    if (backwards)
      circular_previous(i, spv);
    else
      circular_next(i, spv);
  }
  return p;
}
Ejemplo n.º 3
0
AirspaceRoute::ClearingPair
AirspaceRoute::FindClearingPair(const SearchPointVector& spv,
                                const SearchPointVector::const_iterator start,
                                const SearchPointVector::const_iterator end,
                                const RoutePoint &dest) const
{
  bool backwards = false;
  ClearingPair p(dest, dest);

  bool check_others = false;

  SearchPointVector::const_iterator i= start;

  int j=0;
  while ((i != end)&&(j<2)) {
    AFlatGeoPoint pborder(i->GetFlatLocation(), dest.altitude); // @todo alt!
    const FlatRay ray(pborder, dest);

    if (spv.IntersectsWith(ray)) {
      j++;
      if (j==1) {
        i = start;
        backwards = true;
        continue;
      }
    } else {
      AGeoPoint gborder(task_projection.Unproject(pborder), dest.altitude); // @todo alt!
      if (!check_others || !InsideOthers(gborder)) {
        if (j==0) {
          p.first = pborder;
        } else if (j==1) {
          p.second = pborder;
        }
      }
    }

    i = backwards ? spv.PreviousCircular(i) : spv.NextCircular(i);
  }

  return p;
}