#pragma once
#include "ShapeLocation.h"

class CircularLocation : public ShapeLocation
{
public:
  CircularLocation(BWAPI::Position center, int radius)
    : m_center(center)
    , m_radius(radius)
  {
  }

  virtual bool isInLocation(BWAPI::Position position) const
  {
    //const double distance = m_center.getDistance(position);
    //return (distance <= static_cast<double>(m_radius));

    return m_center.getApproxDistance(position) <= m_radius;
  }

  virtual bool isInLocation(BWAPI::TilePosition tile) const;


  virtual BWAPI::Position getCurrentCenter() const
  {
    return m_center;
  }

  int getRadius() const
  {
    return m_radius;
  }
protected:
  virtual void _output(std::ostream& out) const
  {
    out << "Circle(" << m_center << ", " << m_radius << ")";
  }

  const BWAPI::Position m_center;
  const int m_radius;

private:
  // const member prevent the use of assignment operator
  CircularLocation& operator=(const CircularLocation&);
};