#include "stdafx.h"
#include "CoordinatesLocation.h"
#include "../../../PerceptualState.h"

BWAPI::Position CoordinatesLocation::getCurrentCenter() const
{
  return m_coordinates;
}

bool CoordinatesLocation::isInLocation(BWAPI::Position position) const
{
  return m_coordinates == position;
}

bool CoordinatesLocation::isInLocation(BWAPI::TilePosition tile) const
{
  return BWAPI::TilePosition(m_coordinates) == tile;
}

std::pair<BWAPI::TilePosition, int> CoordinatesLocation::getOldestVisibleTile() const
{
  BWAPI::TilePosition tile = BWAPI::TilePosition(m_coordinates);
  int lastVisible = Spar->getPerceptualState()->getVisibility()->getData(tile).lastVisible;
  return std::make_pair(tile, lastVisible);
}

BWAPI::TilePosition CoordinatesLocation::getRandomTile() const
{
  return BWAPI::TilePosition(m_coordinates);
}