src/ai/api/ai_map.cpp
author rubidium
Sun, 25 Mar 2007 13:50:19 +0000
branchnoai
changeset 9524 283d23931bb4
parent 9502 5eb285182114
child 9655 e8e43f333832
permissions -rw-r--r--
(svn r9444) [NoAI] -Codechange: allow all API-class-instances to be used as parameters in Squirrel.
/* $Id$ */

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

#include "ai_map.hpp"
#include "../../command.h"

bool AIMap::IsValidTile(TileIndex t)
{
	return t < this->GetMapSize();
}

TileIndex AIMap::GetMapSize()
{
	return ::MapSize();
}

uint32 AIMap::GetMapSizeX()
{
	return ::MapSizeX();
}

uint32 AIMap::GetMapSizeY()
{
	return ::MapSizeY();
}

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

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

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

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

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

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

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

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