src/ai/api/ai_map.cpp
author rubidium
Wed, 09 Jan 2008 18:11:12 +0000
branchnoai
changeset 9723 eee46cb39750
parent 9655 e8e43f333832
child 9737 ee408edf3851
permissions -rw-r--r--
(svn r11796) [NoAI] -Sync: with trunk r11502:11795.
/* $Id$ */

/** @file ai_map.cpp handles the query-related of the AIMap class */

#include "ai_map.hpp"
#include "../../command_type.h"
#include "../../map_func.h"

/* static */ bool AIMap::IsValidTile(TileIndex t)
{
	return t < AIMap::GetMapSize();
}

/* static */ TileIndex AIMap::GetMapSize()
{
	return ::MapSize();
}

/* static */ uint32 AIMap::GetMapSizeX()
{
	return ::MapSizeX();
}

/* static */ uint32 AIMap::GetMapSizeY()
{
	return ::MapSizeY();
}

/* static */ uint32 AIMap::GetTileX(TileIndex t)
{
	return ::TileX(t);
}

/* static */ uint32 AIMap::GetTileY(TileIndex t)
{
	return ::TileY(t);
}

/* static */ TileIndex AIMap::GetTileIndex(uint32 x, uint32 y)
{
	return ::TileXY(x, y);
}

/* static */ uint32 AIMap::DistanceManhattan(TileIndex t1, TileIndex t2)
{
	return ::DistanceManhattan(t1, t2);
}

/* static */ uint32 AIMap::DistanceMax(TileIndex t1, TileIndex t2)
{
	return ::DistanceMax(t1, t2);
}

/* static */ uint32 AIMap::DistanceSquare(TileIndex t1, TileIndex t2)
{
	return ::DistanceSquare(t1, t2);
}

/* static */ uint32 AIMap::DistanceFromEdge(TileIndex t)
{
	return ::DistanceFromEdge(t);
}

bool AIMap::DemolishTile(TileIndex t)
{
	return this->DoCommand(t, 0, 0, CMD_LANDSCAPE_CLEAR);
}