src/ai/api/ai_tile.cpp
author rubidium
Sun, 15 Jul 2007 16:39:11 +0000
branchnoai
changeset 9668 6fe3d2cb9655
parent 9658 e7675771bca4
child 9697 a6a9379988f6
permissions -rw-r--r--
(svn r10582) [NoAI] -Codechange: allow getting the president and company names of other companies as well as their company value and bank balance.
/* $Id$ */

/** @file ai_tile.cpp handles the functions of the AITile class */

#include "ai_tile.hpp"
#include "../../tile.h"
#include "../../variables.h"
#include "../../station.h"

bool AITile::IsBuildable(TileIndex tile)
{
	/* Outside of the map */
	if (tile >= ::MapSize()) return false;

	switch (::GetTileType(tile)) {
		default: return 1;
		case MP_VOID:
		case MP_HOUSE:
		case MP_STATION:
		case MP_INDUSTRY:
		case MP_UNMOVABLE: return 0;
	}
}

int32 AITile::GetSlope(TileIndex tile)
{
	/* Outside of the map */
	if (tile >= ::MapSize()) return 0;

	return GetTileSlope(tile, NULL);
}

int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint rad)
{
	/* Outside of the map */
	if (tile >= ::MapSize()) return false;

	AcceptedCargo accepts;
	GetAcceptanceAroundTiles(accepts, tile, width, height, _patches.modified_catchment ? rad : 4);
	return accepts[cargo_type];
}