(svn r12226) [NoAI] -Fix: remove the dep for AIStationList_Vehicle on AIStationList, as Squirrel doesn't like it
/* $Id$ */
/** @file ai_tile.cpp handles the functions of the AITile class */
#include "ai_tile.hpp"
#include "../../tile_map.h"
#include "../../map_func.h"
#include "../../variables.h"
#include "../../station.h"
#include "../../command_type.h"
#include "../../settings_type.h"
/* static */ bool AITile::IsBuildable(TileIndex tile)
{
/* Outside of the map */
if (tile >= ::MapSize()) return false;
switch (::GetTileType(tile)) {
default: return true;
case MP_VOID:
case MP_HOUSE:
case MP_STATION:
case MP_INDUSTRY:
case MP_UNMOVABLE:
case MP_WATER: return false;
}
}
/* static */ bool AITile::IsWater(TileIndex tile)
{
/* Outside of the map */
if (tile >= ::MapSize()) return false;
return ::GetTileType(tile) == MP_WATER;
}
/* static */ int32 AITile::GetSlope(TileIndex tile)
{
/* Outside of the map */
if (tile >= ::MapSize()) return 0;
return ::GetTileSlope(tile, NULL);
}
/* static */ int32 AITile::GetHeight(TileIndex tile)
{
/* Outside of the map */
if (tile >= ::MapSize()) return 0;
return ::TileHeight(tile);
}
/* static */ int32 AITile::GetCargoAcceptance(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius)
{
/* Outside of the map */
if (tile >= ::MapSize()) return 0;
AcceptedCargo accepts;
::GetAcceptanceAroundTiles(accepts, tile, width, height, _patches.modified_catchment ? radius : (uint)CA_UNMODIFIED);
return accepts[cargo_type];
}
/* static */ int32 AITile::GetCargoProduction(TileIndex tile, CargoID cargo_type, uint width, uint height, uint radius)
{
/* Outside of the map */
if (tile >= ::MapSize()) return 0;
AcceptedCargo produced;
::GetProductionAroundTiles(produced, tile, width, height, _patches.modified_catchment ? radius : (uint)CA_UNMODIFIED);
return produced[cargo_type];
}
/* static */ bool AITile::RaiseTile(TileIndex tile, int32 slope)
{
/* Outside of the map */
if (tile >= ::MapSize()) return false;
return AIObject::DoCommand(tile, slope, 1, CMD_TERRAFORM_LAND);
}
/* static */ bool AITile::LowerTile(TileIndex tile, int32 slope)
{
/* Outside of the map */
if (tile >= ::MapSize()) return false;
return AIObject::DoCommand(tile, slope, 0, CMD_TERRAFORM_LAND);
}