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

BWAPI::Position Tile::getCurrentCenter() const
{
  BWAPI::Position pos(*this);
  return BWAPI::Position(pos.x() + TILE_SIZE / 2,
                         pos.y() + TILE_SIZE / 2);
}

bool Tile::isInLocation(BWAPI::Position pos) const
{
  BWAPI::TilePosition tile(pos);
  return tile == *this;
}

bool Tile::isInLocation(BWAPI::TilePosition tile) const
{
  return tile == *this;
}

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

BWAPI::TilePosition Tile::getRandomTile() const
{
  return BWAPI::TilePosition(m_x, m_y);
}
