#pragma once
#include "../../Utils/ReferenceCountedComponent.h"
#include "../UnitRecord/UnitRecord.h"

//Forward declarations
namespace BWAPI { class Position; };
namespace BWAPI { class TilePosition; };

/**
 * @brief Base class for locations, which represent some kind of subset of the map.
 */
class Location : public ReferenceCountedComponent
{
public:
  virtual ~Location() {}

  /**
   * @brief Returns what can be thought of as the center of the location (sometimes not too well-defined).
   * @return The current center of the location.
   */
  virtual BWAPI::Position getCurrentCenter() const = 0;

  /**
   * @return Whether the given position is included in this location.
   */
  virtual bool isInLocation(BWAPI::Position position) const = 0;

  /**
   * @return Whether the given tile is at least partially included in this location.
   */
  virtual bool isInLocation(BWAPI::TilePosition tile) const = 0;

  bool isInLocation(const UnitRecord* unit) const
  {
    return isInLocation(unit->getPosition());
  }

  bool isInLocation(const BWAPI::Unit* unit) const
  {
    return isInLocation(unit->getPosition());
  }

private:
  Location& operator=(const Location&);
};
